Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -12,6 +12,7 @@ desc = "### This is a simple AI tool. Write your problem or situation (personal
|
|
12 |
warning = "Warning!\n **PLEASE READ THE DISCLAIMER BELOW** This isn't a 100% accurate tool; not all Hadiths are present in the database, and some results might be repetitive. If that's the case, try generating more Hadiths with the selector.\nMore informations describing how the tool works are coming soon\n\n## DISCLAIMER\n\nTHIS TOOL IS INTENDED FOR REFERENCE PURPOSES ONLY AND IS NOT INTENDED TO BE TAKEN AS RELIGIOUS ADVICE. THE HADITHS DISPLAYED BY THIS TOOL ARE NOT INTENDED TO BE USED AS A SOLE SOURCE OF RELIGIOUS GUIDANCE. USERS ARE RESPONSIBLE FOR CONDUCTING THEIR OWN RESEARCH AND SEEKING GUIDANCE FROM RELIGIOUS SCHOLARS.\n\nPLEASE NOTE THAT THE CONTENT DISPLAYED BY THIS TOOL IS NOT GUARANTEED TO BE ACCURATE, COMPLETE, OR UP-TO-DATE.\n\nTHE DEVELOPERS OF THIS TOOL WILL NOT BE HELD RESPONSIBLE FOR ANY DECISIONS MADE BY THE USERS OF THIS TOOL THAT ARE BASED ON THE CONTENT DISPLAYED BY THIS TOOL.\n\nHadiths gathered from this repository: https:\/\/www.kaggle.com\/datasets\/fahd09\/hadith-dataset"
|
13 |
|
14 |
def update_results(text_area, number_to_display=10):
|
|
|
15 |
results = hadith_search.search_hadiths(text_area, number_to_display)
|
16 |
return results
|
17 |
|
@@ -31,13 +32,13 @@ with gr.Blocks(title=title) as demo:
|
|
31 |
submit_button = gr.Button(value="Find hadiths relevant to my story")
|
32 |
pass
|
33 |
|
34 |
-
fn = partial(update_results)
|
35 |
|
36 |
with gr.Accordion("Relevant Hadiths (Rerun if results are not satisfying"):
|
37 |
response_display = gr.Markdown("Empty")
|
38 |
|
39 |
-
submit_button.click(fn=
|
40 |
-
demo.launch(max_threads=40)
|
41 |
|
42 |
|
43 |
|
|
|
12 |
warning = "Warning!\n **PLEASE READ THE DISCLAIMER BELOW** This isn't a 100% accurate tool; not all Hadiths are present in the database, and some results might be repetitive. If that's the case, try generating more Hadiths with the selector.\nMore informations describing how the tool works are coming soon\n\n## DISCLAIMER\n\nTHIS TOOL IS INTENDED FOR REFERENCE PURPOSES ONLY AND IS NOT INTENDED TO BE TAKEN AS RELIGIOUS ADVICE. THE HADITHS DISPLAYED BY THIS TOOL ARE NOT INTENDED TO BE USED AS A SOLE SOURCE OF RELIGIOUS GUIDANCE. USERS ARE RESPONSIBLE FOR CONDUCTING THEIR OWN RESEARCH AND SEEKING GUIDANCE FROM RELIGIOUS SCHOLARS.\n\nPLEASE NOTE THAT THE CONTENT DISPLAYED BY THIS TOOL IS NOT GUARANTEED TO BE ACCURATE, COMPLETE, OR UP-TO-DATE.\n\nTHE DEVELOPERS OF THIS TOOL WILL NOT BE HELD RESPONSIBLE FOR ANY DECISIONS MADE BY THE USERS OF THIS TOOL THAT ARE BASED ON THE CONTENT DISPLAYED BY THIS TOOL.\n\nHadiths gathered from this repository: https:\/\/www.kaggle.com\/datasets\/fahd09\/hadith-dataset"
|
13 |
|
14 |
def update_results(text_area, number_to_display=10):
|
15 |
+
print("run update results")
|
16 |
results = hadith_search.search_hadiths(text_area, number_to_display)
|
17 |
return results
|
18 |
|
|
|
32 |
submit_button = gr.Button(value="Find hadiths relevant to my story")
|
33 |
pass
|
34 |
|
35 |
+
$fn = partial(update_results)
|
36 |
|
37 |
with gr.Accordion("Relevant Hadiths (Rerun if results are not satisfying"):
|
38 |
response_display = gr.Markdown("Empty")
|
39 |
|
40 |
+
submit_button.click(fn=update_results, inputs=[text_area,number_to_display], outputs=[response_display])
|
41 |
+
demo.launch(max_threads=40, show_error=True)
|
42 |
|
43 |
|
44 |
|