shripadbhat commited on
Commit
03c65d9
·
1 Parent(s): 3f87bd6

QA pipeline

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -1,14 +1,14 @@
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
- def greet(name):
5
- return "Hello " + name + "!"
6
 
7
- with gr.Blocks() as demo:
8
- name = gr.Textbox(label="Enter your question here")
9
- submit_btn = gr.Button("Submit")
10
- submit_btn.click(fn=greet, inputs=name)
11
- #output = gr.Textbox(label="Output Box")
12
 
13
-
14
- demo.launch()
 
 
 
 
 
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
+ qa_model = pipeline("question-answering",'a-ware/bart-squadv2')
 
5
 
6
+ def fetch_answer(name):
7
+ return qa_model(question = question, context = context)['answer']
 
 
 
8
 
9
+ demo = gr.Interface(
10
+ fn=fetch_answer,
11
+ inputs=gr.Textbox(lines=2, placeholder="Name Here..."),
12
+ outputs="text",
13
+ )
14
+ demo.launch()