Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,8 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from simpletransformers.question_answering import QuestionAnsweringModel
|
| 3 |
|
| 4 |
# Load model from training checkpoint
|
|
|
|
|
|
|
| 5 |
model = QuestionAnsweringModel("bert", "./bert_outputs/bert/best_model", use_cuda=False)
|
| 6 |
|
| 7 |
# Função para realizar predições
|
|
@@ -14,10 +15,10 @@ def perform_prediction(context, question):
|
|
| 14 |
iface = gr.Interface(
|
| 15 |
fn=perform_prediction,
|
| 16 |
inputs=[
|
| 17 |
-
gr.Textbox(placeholder="
|
| 18 |
-
gr.Textbox(placeholder="
|
| 19 |
],
|
| 20 |
-
outputs=gr.Textbox(label="
|
| 21 |
live=True,
|
| 22 |
theme="compact",
|
| 23 |
)
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
|
| 3 |
# Load model from training checkpoint
|
| 4 |
+
from simpletransformers.question_answering import QuestionAnsweringModel, QuestionAnsweringArgs
|
| 5 |
+
|
| 6 |
model = QuestionAnsweringModel("bert", "./bert_outputs/bert/best_model", use_cuda=False)
|
| 7 |
|
| 8 |
# Função para realizar predições
|
|
|
|
| 15 |
iface = gr.Interface(
|
| 16 |
fn=perform_prediction,
|
| 17 |
inputs=[
|
| 18 |
+
gr.Textbox(placeholder="Insira o contexto aqui...", label="Contexto"),
|
| 19 |
+
gr.Textbox(placeholder="Faça uma pergunta sobre o contexto...", label="Pergunta")
|
| 20 |
],
|
| 21 |
+
outputs=gr.Textbox(label="Resposta"),
|
| 22 |
live=True,
|
| 23 |
theme="compact",
|
| 24 |
)
|