Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from simplet5 import SimpleT5
|
| 3 |
+
|
| 4 |
+
model = SimpleT5()
|
| 5 |
+
# let's load the trained model for inferencing:
|
| 6 |
+
model.load_model("byt5","hantech/byt5_correct2", use_gpu=False)
|
| 7 |
+
|
| 8 |
+
def predict(img, text):
|
| 9 |
+
result = model.predict(text)
|
| 10 |
+
return result[0]
|
| 11 |
+
|
| 12 |
+
gr.Interface(predict, [gr.Image(type="filepath"), gr.Textbox(label="Question")], gr.Textbox()).launch()
|