sagawa commited on
Commit
8f7fecd
1 Parent(s): f01f3e2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -10
app.py CHANGED
@@ -1,9 +1,9 @@
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:
@@ -13,11 +13,21 @@ with gr.Blocks() as demo:
13
  **Predict the protein half-life from its sequence or PDB file.**
14
  """
15
  )
16
- gr.Markdown("![model image](https://github.com/sagawatatsuya/PLTNUM/blob/main/model-image.png?raw=true)")
17
-
18
- model_choice = gr.Radio(choices=["SaProt", "ESM-2"], label="Select PLTNUM's base model.", value="SaProt")
19
- organism_choice = gr.Radio(choices=["Mouse", "Human"], label="Select the target organism.", value="Mouse")
20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
 
22
  with gr.Tabs():
23
  with gr.TabItem("Upload PDB File"):
@@ -26,7 +36,7 @@ with gr.Blocks() as demo:
26
  predict_button = gr.Button("Predict Stability")
27
  prediction_output = gr.Textbox(label="Stability Prediction", interactive=False)
28
 
29
- predict_button.click(fn=predict_stability, inputs=[model_choice, pdb_file], outputs=prediction_output)
30
 
31
  with gr.TabItem("Enter Protein Sequence"):
32
  gr.Markdown("### Enter the protein sequence:")
@@ -38,12 +48,13 @@ with gr.Blocks() as demo:
38
  predict_button = gr.Button("Predict Stability")
39
  prediction_output = gr.Textbox(label="Stability Prediction", interactive=False)
40
 
41
- predict_button.click(fn=predict_stability, inputs=[model_choice, sequence], outputs=prediction_output)
42
 
43
  gr.Markdown(
44
  """
45
  ### How to Use:
46
- - **Select Model**: Choose between 'Model A' or 'Model B' for your prediction.
 
47
  - **Upload PDB File**: Choose the 'Upload PDB File' tab and upload your file.
48
  - **Enter Sequence**: Alternatively, switch to the 'Enter Protein Sequence' tab and input your sequence.
49
  - **Predict**: Click 'Predict Stability' to receive the prediction.
@@ -57,4 +68,4 @@ with gr.Blocks() as demo:
57
  """
58
  )
59
 
60
- demo.launch()
 
1
  import gradio as gr
2
 
3
  # Assuming 'predict_stability' is your function that predicts protein stability
4
+ def predict_stability(model_choice, organism_choice, pdb_file=None, sequence=None):
5
  # Dummy return for illustration; replace with your actual prediction logic
6
+ return f"Predicted Stability using {model_choice} for {organism_choice}: Example Output"
7
 
8
  # Gradio Interface
9
  with gr.Blocks() as demo:
 
13
  **Predict the protein half-life from its sequence or PDB file.**
14
  """
15
  )
 
 
 
 
16
 
17
+ gr.Image("https://github.com/sagawatatsuya/PLTNUM/blob/main/model-image.png?raw=true", label="Model Image")
18
+
19
+ # Model and Organism selection in the same row to avoid layout issues
20
+ with gr.Row():
21
+ model_choice = gr.Radio(
22
+ choices=["SaProt", "ESM-2"],
23
+ label="Select PLTNUM's base model.",
24
+ value="SaProt"
25
+ )
26
+ organism_choice = gr.Radio(
27
+ choices=["Mouse", "Human"],
28
+ label="Select the target organism.",
29
+ value="Mouse"
30
+ )
31
 
32
  with gr.Tabs():
33
  with gr.TabItem("Upload PDB File"):
 
36
  predict_button = gr.Button("Predict Stability")
37
  prediction_output = gr.Textbox(label="Stability Prediction", interactive=False)
38
 
39
+ predict_button.click(fn=predict_stability, inputs=[model_choice, organism_choice, pdb_file], outputs=prediction_output)
40
 
41
  with gr.TabItem("Enter Protein Sequence"):
42
  gr.Markdown("### Enter the protein sequence:")
 
48
  predict_button = gr.Button("Predict Stability")
49
  prediction_output = gr.Textbox(label="Stability Prediction", interactive=False)
50
 
51
+ predict_button.click(fn=predict_stability, inputs=[model_choice, organism_choice, sequence], outputs=prediction_output)
52
 
53
  gr.Markdown(
54
  """
55
  ### How to Use:
56
+ - **Select Model**: Choose between 'SaProt' or 'ESM-2' for your prediction.
57
+ - **Select Organism**: Choose between 'Mouse' or 'Human'.
58
  - **Upload PDB File**: Choose the 'Upload PDB File' tab and upload your file.
59
  - **Enter Sequence**: Alternatively, switch to the 'Enter Protein Sequence' tab and input your sequence.
60
  - **Predict**: Click 'Predict Stability' to receive the prediction.
 
68
  """
69
  )
70
 
71
+ demo.launch()