Spaces:
Running
Running
nrjvarshney
commited on
Commit
•
dfa00a2
1
Parent(s):
229f7f9
adding answer check
Browse files
app.py
CHANGED
@@ -21,9 +21,10 @@ def get_question(answer, context, max_length=64):
|
|
21 |
|
22 |
import gradio as gr
|
23 |
|
24 |
-
def greet(
|
25 |
-
print("Entered topic: ",
|
26 |
-
topics = wikipedia.search(
|
|
|
27 |
random.shuffle(topics)
|
28 |
for topic in topics:
|
29 |
try:
|
@@ -46,7 +47,7 @@ def greet(topic):
|
|
46 |
answers = doc.ents
|
47 |
filtered_answers = []
|
48 |
for answer in answers:
|
49 |
-
if(answer.text in
|
50 |
pass
|
51 |
else:
|
52 |
filtered_answers.append(answer)
|
|
|
21 |
|
22 |
import gradio as gr
|
23 |
|
24 |
+
def greet(entered_topic):
|
25 |
+
print("Entered topic: ", entered_topic)
|
26 |
+
topics = wikipedia.search(entered_topic)
|
27 |
+
topics = topics[:3]
|
28 |
random.shuffle(topics)
|
29 |
for topic in topics:
|
30 |
try:
|
|
|
47 |
answers = doc.ents
|
48 |
filtered_answers = []
|
49 |
for answer in answers:
|
50 |
+
if(answer.text.lower() in entered_topic.lower() or entered_topic.lower() in answer.text.lower()):
|
51 |
pass
|
52 |
else:
|
53 |
filtered_answers.append(answer)
|