File size: 457 Bytes
245e12c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from transformers import pipeline
import gradio as gr

question_answerer = pipeline("question-answering")


def main(context, question):
    answer = question_answerer(
        question=question,
        context=context,
    )
    return answer


demo = gr.Interface(
    fn=main,
    inputs=["text", "text"],
    outputs="text",
    title="Question Answering"
)

demo.launch(
    inbrowser=True,
    show_error=True,
    show_tips=True,
    show_api=False)