Spaces:
Runtime error
Runtime error
Ahsen Khaliq
commited on
Commit
·
7e8fab9
1
Parent(s):
68952c6
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,7 +7,29 @@ description = "Gradio Demo for T5. To use it, simply add your text, or click one
|
|
| 7 |
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/1910.10683' target='_blank'>Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer</a></p>"
|
| 8 |
|
| 9 |
examples = [
|
| 10 |
-
['My name is Sarah and I live in London']
|
| 11 |
]
|
| 12 |
|
| 13 |
-
gr.Interface.load("huggingface/t5-base"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/1910.10683' target='_blank'>Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer</a></p>"
|
| 8 |
|
| 9 |
examples = [
|
| 10 |
+
['My name is Sarah and I live in London',"t5-base"]
|
| 11 |
]
|
| 12 |
|
| 13 |
+
io1 = gr.Interface.load("huggingface/t5-base")
|
| 14 |
+
|
| 15 |
+
io2 = gr.Interface.load("huggingface/t5-small")
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def inference(text, model):
|
| 19 |
+
if model == "t5-base":
|
| 20 |
+
outtext = io1(text)
|
| 21 |
+
else:
|
| 22 |
+
outtext = io2(text)
|
| 23 |
+
return outtext
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
gr.Interface(
|
| 28 |
+
inference,
|
| 29 |
+
[gr.inputs.Textbox(label="Input"),gr.inputs.Dropdown(choices=["t5-base","t5-small"], type="value", default="t5-base", label="model")
|
| 30 |
+
],
|
| 31 |
+
gr.outputs.Textbox(label="Output"),
|
| 32 |
+
examples=examples,
|
| 33 |
+
article=article,
|
| 34 |
+
title=title,
|
| 35 |
+
description=description).launch(enable_queue=True, cache_examples=True)
|