basimmughal3 commited on
Commit
daed375
1 Parent(s): 429e86f

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -0
app.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ pipe = pipeline("question-answering", model="google/bigbird-base-trivia-itc")
5
+
6
+ def main(question, context):
7
+ answer = pipe(question=question, context=context)
8
+ return answer["answer"]
9
+
10
+ with gr.Blocks() as demo:
11
+ gr.Markdown("""# Question Answerer!""")
12
+ with gr.Row():
13
+ with gr.Column():
14
+ text1 = gr.Textbox(
15
+ label="Question",
16
+ lines=1,
17
+ value="Who does Cristiano Ronaldo play for?",
18
+ )
19
+ text2 = gr.Textbox(
20
+ label="Context",
21
+ lines=3,
22
+ value="Cristiano Ronaldo is a player for Manchester United",
23
+ )
24
+ output = gr.Textbox()
25
+ b1 = gr.Button("Ask Question!")
26
+ b1.click(main, inputs=[text1, text2], outputs=output)
27
+ gr.Markdown("""#### powered by [Tassle](https://bit.ly/3LXMklV)""")
28
+
29
+
30
+ if __name__ == "__main__":
31
+ demo.launch()