nalinaksh commited on
Commit
d0dd661
·
1 Parent(s): 91fe304

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -0
app.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ from transformers import pipeline
4
+
5
+ qa = pipeline("question-answering")
6
+
7
+ def question_answering(question, context):
8
+ return qa(question, context)["answer"]
9
+
10
+ question = "What is Pragyan?"
11
+ context = "Chandrayaan-3 is the third and most recent lunar Indian Space Research exploration mission under the Chandrayaan programme of ISRO. It consists of a lander named Vikram and a rover named Pragyan similar to Chandrayaan-2. Its propulsion module behaves like a communication relay satellite."
12
+
13
+ title = "Extractive question answering"
14
+ description = """
15
+ <img src="https://www.zdnet.com/a/img/resize/1a8d2c93f1f51f9f33d21d7224840dfcf06f5a50/2023/02/14/328d5be2-918d-4aee-8690-875aed4a8c8a/gettyimages-1458045238-1.jpg?auto=webp&width=1280" width=200px>
16
+ """
17
+ question_box = gr.Textbox(label="Question:", placeholder="What is Pragyan?", lines=2)
18
+ context_box = gr.Textbox(label="Context", placeholder=context, lines=10)
19
+ demo = gr.Interface(fn=question_answering,
20
+ inputs=[question_box, context_box],
21
+ outputs="text",
22
+ title=title,
23
+ description=description)
24
+
25
+ demo.launch()