Bofandra commited on
Commit
d8758a7
1 Parent(s): 3836430

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -4,8 +4,10 @@ import pandas as pd
4
  import pickle
5
 
6
  def make_clickable_both(val):
7
- name, url = val.split('#')
8
- return f'<a href="{url}">{name}</a>'
 
 
9
 
10
  def find(query):
11
  def get_detailed_instruct(task_description: str, query: str) -> str:
@@ -54,13 +56,13 @@ def find(query):
54
  #results = results + result_quran['text'].item()+" (Q.S "+str(result['sura']).rstrip('.0')+":"+str(result['aya']).rstrip('.0')+")\n"
55
  i=i+1
56
 
57
- results['text'] = results['text'] + '#' + 'https://quran.com/'+str(result['sura']).rstrip('.0')+':'+str(result['aya']).rstrip('.0')+'/tafsirs/en-tafisr-ibn-kathir'
58
  results.style.format({'text': make_clickable_both})
59
 
60
  #return sorted_quran
61
  return results
62
 
63
- demo = gr.Interface(fn=find, inputs="textbox", outputs=gr.Dataframe(headers=['sura', 'aya', 'similarity', 'text'],wrap=True))
64
  #demo = gr.Interface(fn=find, inputs="textbox", outputs="textbox")
65
 
66
  if __name__ == "__main__":
 
4
  import pickle
5
 
6
  def make_clickable_both(val):
7
+ name, url = val.split('#')
8
+ print(name+"\n")
9
+ print(url+"\n")
10
+ return f'<a href="{url}">{name}</a>'
11
 
12
  def find(query):
13
  def get_detailed_instruct(task_description: str, query: str) -> str:
 
56
  #results = results + result_quran['text'].item()+" (Q.S "+str(result['sura']).rstrip('.0')+":"+str(result['aya']).rstrip('.0')+")\n"
57
  i=i+1
58
 
59
+ results['text'] = results['text'] + '#' + 'https://quran.com/'+results['sura']+':'+results['aya']+'/tafsirs/en-tafisr-ibn-kathir'
60
  results.style.format({'text': make_clickable_both})
61
 
62
  #return sorted_quran
63
  return results
64
 
65
+ demo = gr.Interface(fn=find, inputs="textbox", outputs=gr.Dataframe(headers=['sura', 'aya', 'text'],wrap=True))
66
  #demo = gr.Interface(fn=find, inputs="textbox", outputs="textbox")
67
 
68
  if __name__ == "__main__":