Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,4 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
import gradio.inputs
|
| 3 |
-
import gradio.outputs
|
| 4 |
from transformers.pipelines import pipeline
|
| 5 |
|
| 6 |
model_names = ["IT5 Small", "IT5 Base", "IT5 Large", "mT5 Small", "mT5 Base", "IT5 Small Efficient"]
|
|
@@ -11,7 +9,7 @@ task_values = ['headline-generation', 'question-answering', 'question-generation
|
|
| 11 |
|
| 12 |
full_ids = {
|
| 13 |
task_id: {
|
| 14 |
-
model_id: f"
|
| 15 |
for model_id in model_values
|
| 16 |
}
|
| 17 |
for task_id in task_values
|
|
@@ -84,13 +82,13 @@ def get_outputs(text, model_id_idx, task_id_idx):
|
|
| 84 |
iface = gr.Interface(
|
| 85 |
fn=get_outputs,
|
| 86 |
inputs=[
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
],
|
| 91 |
outputs=[
|
| 92 |
-
|
| 93 |
-
|
| 94 |
],
|
| 95 |
examples = examples,
|
| 96 |
title="IT5 Sequence-to-sequence Demo 🇮🇹",
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
| 2 |
from transformers.pipelines import pipeline
|
| 3 |
|
| 4 |
model_names = ["IT5 Small", "IT5 Base", "IT5 Large", "mT5 Small", "mT5 Base", "IT5 Small Efficient"]
|
|
|
|
| 9 |
|
| 10 |
full_ids = {
|
| 11 |
task_id: {
|
| 12 |
+
model_id: f"gsarti/{model_id}-{task_id}"
|
| 13 |
for model_id in model_values
|
| 14 |
}
|
| 15 |
for task_id in task_values
|
|
|
|
| 82 |
iface = gr.Interface(
|
| 83 |
fn=get_outputs,
|
| 84 |
inputs=[
|
| 85 |
+
gr.Textbox(label="Text", lines=20, placeholder="Enter a text here..."),
|
| 86 |
+
gr.Dropdown(label="Model", choices=model_names, type="index"),
|
| 87 |
+
gr.Dropdown(label="Task", choices=task_names, type="index")
|
| 88 |
],
|
| 89 |
outputs=[
|
| 90 |
+
gr.Textbox(label="Generated text:"),
|
| 91 |
+
gr.HTML(label="Model used:"),
|
| 92 |
],
|
| 93 |
examples = examples,
|
| 94 |
title="IT5 Sequence-to-sequence Demo 🇮🇹",
|