Spaces:
Sleeping
Sleeping
Amir Hallaji
commited on
Commit
·
c46b695
1
Parent(s):
8a30d62
add files
Browse files- app.py +39 -0
- requirements.txt +1 -0
app.py
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import random
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
# Placeholder prediction function
|
| 6 |
+
def predict_affinity(smiles, sequence):
|
| 7 |
+
# In practice, you'd call your ML model here
|
| 8 |
+
# For now, we just return a random score between 0 and 1
|
| 9 |
+
score = round(random.uniform(0, 1), 4)
|
| 10 |
+
return f"Predicted Affinity Score: {score}"
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
with gr.Blocks(title="Molecule-Protein Affinity Predictor") as demo:
|
| 14 |
+
gr.Markdown("## Molecule–Protein Affinity Prediction")
|
| 15 |
+
gr.Markdown(
|
| 16 |
+
"Enter a **Molecule SMILES string** and a **Protein amino acid sequence** "
|
| 17 |
+
"then click **Predict** to get the affinity score."
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
with gr.Row():
|
| 21 |
+
smiles_input = gr.Textbox(
|
| 22 |
+
label="Molecule SMILES",
|
| 23 |
+
placeholder="e.g. CC(=O)OC1=CC=CC=C1C(=O)O"
|
| 24 |
+
)
|
| 25 |
+
sequence_input = gr.Textbox(
|
| 26 |
+
label="Protein Sequence",
|
| 27 |
+
placeholder="e.g. MVLSPADKTNVKAA..."
|
| 28 |
+
)
|
| 29 |
+
|
| 30 |
+
predict_button = gr.Button("Predict")
|
| 31 |
+
output = gr.Textbox(label="Affinity Score", interactive=False)
|
| 32 |
+
|
| 33 |
+
predict_button.click(
|
| 34 |
+
fn=predict_affinity,
|
| 35 |
+
inputs=[smiles_input, sequence_input],
|
| 36 |
+
outputs=output
|
| 37 |
+
)
|
| 38 |
+
|
| 39 |
+
demo.launch()
|
requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
gradio
|