shashankheg commited on
Commit
f162045
·
verified ·
1 Parent(s): 12e8411

Create app.py

Browse files

Uses Distilbert to answer some questions.

Files changed (1) hide show
  1. app.py +24 -0
app.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from streamlit import context
3
+ from sympy import content
4
+ from transformers import pipeline
5
+
6
+
7
+ question_answerer = pipeline("question-answering", model="shashankheg/my_qa_model")
8
+
9
+
10
+ def QA(Question,Context):
11
+ result=question_answerer(question=Question, context=Context)
12
+ for answer in result:
13
+ return result['answer']
14
+
15
+
16
+ interface = gr.Interface(fn =QA,
17
+ inputs = ['text','text'],
18
+ outputs=['text'],
19
+ title= 'Qustion Answering using Distilbert',
20
+ theme = gr.themes.Citrus(),
21
+ css = """"
22
+ body {background-color: #FFCCCB}"""
23
+ )
24
+ interface.launch()