Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
# Assuming 'predict_stability' is your function that predicts protein stability
|
4 |
+
def predict_stability(pdb_file=None, sequence=None):
|
5 |
+
# Dummy return for illustration; replace with your actual prediction logic
|
6 |
+
return "Predicted Stability: Example Output"
|
7 |
+
|
8 |
+
# Gradio Interface
|
9 |
+
with gr.Blocks() as demo:
|
10 |
+
gr.Markdown(
|
11 |
+
"""
|
12 |
+
# Protein Stability Prediction
|
13 |
+
**Predict the stability of a protein from its sequence or PDB file.**
|
14 |
+
"""
|
15 |
+
)
|
16 |
+
|
17 |
+
with gr.Tabs():
|
18 |
+
with gr.TabItem("Upload PDB File"):
|
19 |
+
gr.Markdown("### Upload your PDB file:")
|
20 |
+
pdb_file = gr.File(label="Upload PDB File")
|
21 |
+
predict_button = gr.Button("Predict Stability")
|
22 |
+
prediction_output = gr.Textbox(label="Stability Prediction", interactive=False)
|
23 |
+
|
24 |
+
predict_button.click(fn=predict_stability, inputs=pdb_file, outputs=prediction_output)
|
25 |
+
|
26 |
+
with gr.TabItem("Enter Protein Sequence"):
|
27 |
+
gr.Markdown("### Enter the protein sequence:")
|
28 |
+
sequence = gr.Textbox(
|
29 |
+
label="Protein Sequence",
|
30 |
+
placeholder="Enter your protein sequence here...",
|
31 |
+
lines=8,
|
32 |
+
)
|
33 |
+
predict_button = gr.Button("Predict Stability")
|
34 |
+
prediction_output = gr.Textbox(label="Stability Prediction", interactive=False)
|
35 |
+
|
36 |
+
predict_button.click(fn=predict_stability, inputs=sequence, outputs=prediction_output)
|
37 |
+
|
38 |
+
with gr.Row():
|
39 |
+
gr.Markdown(
|
40 |
+
"""
|
41 |
+
### How to Use:
|
42 |
+
- **Upload PDB File**: Choose the 'Upload PDB File' tab and upload your file.
|
43 |
+
- **Enter Sequence**: Alternatively, switch to the 'Enter Protein Sequence' tab and input your sequence.
|
44 |
+
- **Predict**: Click 'Predict Stability' to receive the prediction.
|
45 |
+
"""
|
46 |
+
)
|
47 |
+
|
48 |
+
gr.Markdown(
|
49 |
+
"""
|
50 |
+
### About the Tool
|
51 |
+
This tool allows researchers and scientists to predict the stability of proteins using advanced algorithms. It supports both PDB file uploads and direct sequence input.
|
52 |
+
"""
|
53 |
+
)
|
54 |
+
|
55 |
+
demo.launch()
|