Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -4,7 +4,7 @@ from transformers import T5Tokenizer, T5ForConditionalGeneration
|
|
4 |
tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-large")
|
5 |
model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-large")
|
6 |
|
7 |
-
title = "
|
8 |
|
9 |
def get_examples ():
|
10 |
return [
|
@@ -23,15 +23,19 @@ on Friday is higher by 40 * 40/100 = <<40*40/100=16>>16 books. How many books do
|
|
23 |
def text2text(input_text):
|
24 |
input_ids = tokenizer(input_text, return_tensors="pt").input_ids
|
25 |
|
26 |
-
outputs = model.generate(input_ids, max_length=
|
27 |
return tokenizer.decode(outputs[0])
|
28 |
|
29 |
|
30 |
with gr.Blocks() as demo:
|
31 |
-
|
|
|
|
|
|
|
|
|
32 |
txt_in = gr.Textbox(label="Input", lines=3)
|
33 |
correct_label = gr.Label(label="Correct")
|
34 |
-
txt_out = gr.Textbox(value="", label="Output", lines=
|
35 |
|
36 |
|
37 |
btn = gr.Button(value="Submit")
|
@@ -43,7 +47,6 @@ with gr.Blocks() as demo:
|
|
43 |
inputs=[txt_in,correct_label]
|
44 |
)
|
45 |
|
46 |
-
demo.
|
47 |
|
48 |
if __name__ == "__main__":
|
49 |
demo.launch()
|
|
|
4 |
tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-large")
|
5 |
model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-large")
|
6 |
|
7 |
+
title = ""
|
8 |
|
9 |
def get_examples ():
|
10 |
return [
|
|
|
23 |
def text2text(input_text):
|
24 |
input_ids = tokenizer(input_text, return_tensors="pt").input_ids
|
25 |
|
26 |
+
outputs = model.generate(input_ids, max_length=200)
|
27 |
return tokenizer.decode(outputs[0])
|
28 |
|
29 |
|
30 |
with gr.Blocks() as demo:
|
31 |
+
gr.Markdown(
|
32 |
+
"""
|
33 |
+
# Flan T5 Large Demo
|
34 |
+
Prompt the model in the Input box.
|
35 |
+
""")
|
36 |
txt_in = gr.Textbox(label="Input", lines=3)
|
37 |
correct_label = gr.Label(label="Correct")
|
38 |
+
txt_out = gr.Textbox(value="", label="Output", lines=4)
|
39 |
|
40 |
|
41 |
btn = gr.Button(value="Submit")
|
|
|
47 |
inputs=[txt_in,correct_label]
|
48 |
)
|
49 |
|
|
|
50 |
|
51 |
if __name__ == "__main__":
|
52 |
demo.launch()
|