edemgold commited on
Commit
9e84c11
·
1 Parent(s): 9911f17

Add application files

Browse files
Files changed (2) hide show
  1. app.py +30 -0
  2. requirements.txt +2 -0
app.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+
3
+ # Importing Dependancies
4
+
5
+ import gradio as gr
6
+ from transformers import pipeline
7
+
8
+ """# Loading Model Name"""
9
+
10
+ model_name = "deepset/roberta-base-squad2"
11
+
12
+ """# Get Predictions
13
+
14
+ """
15
+
16
+ nlu = pipeline('question-answering', model=model_name, tokenizer=model_name)
17
+
18
+ def func(context, question):
19
+ input = {
20
+ 'question':question,
21
+ 'context':context
22
+ }
23
+ res = nlu(input)
24
+ return res["answer"]
25
+
26
+ descr = "This is a question and Answer Web app, you give it a context and ask it questions based on the context provided"
27
+
28
+ app = gr.Interface(fn=func, inputs=[gr.inputs.Textbox(lines=3, placeholder="put in your context here..."),"text"], outputs="text", title="Question Answer App", description=descr)
29
+
30
+ app.launch()
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ transformers
2
+ torch