Rajut commited on
Commit
295afb9
·
verified ·
1 Parent(s): e37ca40

Upload 3 files

Browse files
Files changed (3) hide show
  1. Q_A_Generation.ipynb +0 -0
  2. app.py +29 -0
  3. requirements.txt +0 -0
Q_A_Generation.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
app.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ def chatbot(question):
4
+ to_predict = [
5
+ {
6
+ "context": "The Normans (Norman: Nourmands; French: Normands; Latin: Normanni) were the people who in the 10th and 11th centuries gave their name to Normandy, a region in France. They were descended from Norse (\"Norman\" comes from \"Norseman\") raiders and pirates from Denmark, Iceland and Norway who, under their leader Rollo, agreed to swear fealty to King Charles III of West Francia. Through generations of assimilation and mixing with the native Frankish and Roman-Gaulish populations, their descendants would gradually merge with the Carolingian-based cultures of West Francia. The distinct cultural and ethnic identity of the Normans emerged initially in the first half of the 10th century, and it continued to evolve over the succeeding centuries.",
7
+ "qas": [
8
+ {
9
+ "question": question,
10
+ "id": "user_question",
11
+ }
12
+ ],
13
+ }
14
+ ]
15
+
16
+ answers, probabilities = model.predict(to_predict)
17
+ top_answer = answers[0]['answer'][0]
18
+ return top_answer
19
+
20
+ iface = gr.Interface(
21
+ fn=chatbot,
22
+ inputs="text",
23
+ outputs="text",
24
+ live=True,
25
+ title="Chatbot Interface",
26
+ description="Ask a question about the Normans",
27
+ )
28
+
29
+ iface.launch()
requirements.txt ADDED
File without changes