nrjvarshney commited on
Commit
dfa00a2
1 Parent(s): 229f7f9

adding answer check

Browse files
Files changed (1) hide show
  1. app.py +5 -4
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(topic):
25
- print("Entered topic: ", topic)
26
- topics = wikipedia.search(topic)
 
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 topic or topic in answer.text):
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)