krrishD commited on
Commit
c2ebdfa
1 Parent(s): 3923900

Upload with huggingface_hub

Browse files
Files changed (2) hide show
  1. app.py +31 -0
  2. requirements.txt +2 -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="distilbert-base-uncased-distilled-squad")
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://spring-soarer-4970.typedream.app/)""")
28
+
29
+
30
+ if __name__ == "__main__":
31
+ demo.launch()
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ gradio
2
+ transformers