File size: 422 Bytes
acca3be
1b1218f
acca3be
59ea7dd
acca3be
1b1218f
 
 
 
acca3be
 
1b1218f
acca3be
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import gradio as gr
from transformers import pipeline

pipe = pipeline("question-answering", model="deepset/roberta-base-squad2-distilled", framework="pt")

def chat(message, history):
    context="A laranja é uma fruta laranja e o limão é uma fruta verde"
    resposta = pipe(question=message, context=context)
    return resposta['answer']


demo = gr.ChatInterface(chat)

if __name__ == "__main__":
    demo.launch()