Update app.py
Browse files
app.py
CHANGED
|
@@ -4,7 +4,7 @@ from transformers import pipeline
|
|
| 4 |
import gradio as gr
|
| 5 |
|
| 6 |
model_checkpoint = "yzimmermann/FART"
|
| 7 |
-
classifier = pipeline("text-classification", model=model_checkpoint,
|
| 8 |
|
| 9 |
def process_smiles(smiles):
|
| 10 |
# Validate and canonicalize SMILES
|
|
@@ -26,14 +26,13 @@ def process_smiles(smiles):
|
|
| 26 |
|
| 27 |
return prediction_dict, img_path, canonical_smiles
|
| 28 |
|
| 29 |
-
# Set up the Gradio interface
|
| 30 |
iface = gr.Interface(
|
| 31 |
fn=process_smiles,
|
| 32 |
-
inputs=gr.
|
| 33 |
outputs=[
|
| 34 |
-
gr.
|
| 35 |
-
gr.
|
| 36 |
-
gr.
|
| 37 |
],
|
| 38 |
title="FART",
|
| 39 |
description="Enter a SMILES string to get the taste classification probabilities."
|
|
|
|
| 4 |
import gradio as gr
|
| 5 |
|
| 6 |
model_checkpoint = "yzimmermann/FART"
|
| 7 |
+
classifier = pipeline("text-classification", model=model_checkpoint, top_k=None)
|
| 8 |
|
| 9 |
def process_smiles(smiles):
|
| 10 |
# Validate and canonicalize SMILES
|
|
|
|
| 26 |
|
| 27 |
return prediction_dict, img_path, canonical_smiles
|
| 28 |
|
|
|
|
| 29 |
iface = gr.Interface(
|
| 30 |
fn=process_smiles,
|
| 31 |
+
inputs=gr.Textbox(label="Input SMILES"),
|
| 32 |
outputs=[
|
| 33 |
+
gr.Label(num_top_classes=3, label="Classification Probabilities"),
|
| 34 |
+
gr.Image(type="file", label="Molecule Image"),
|
| 35 |
+
gr.Textbox(label="Canonical SMILES")
|
| 36 |
],
|
| 37 |
title="FART",
|
| 38 |
description="Enter a SMILES string to get the taste classification probabilities."
|