Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
import gradio as gr
|
2 |
-
|
3 |
import os
|
4 |
from functools import partial
|
5 |
|
6 |
-
|
7 |
-
|
8 |
|
9 |
title = "Smart Hadith -> English version available here:https://huggingface.co/spaces/Adr740/Hadith_AI_Explorer"
|
10 |
desc = "Bienvenue dans Smart Hadith. Expliquer une situation ou un problème (peronnel ou non) et Smart Hadith va retrouver des hadith qui peuvent potentiellement vous aider. Contact suggestions/questions: [[email protected]](mailto:[email protected])"
|
@@ -15,8 +15,8 @@ def update_results(text_area, number_to_display=10):
|
|
15 |
user_input = text_area
|
16 |
print(user_input, number_to_display)
|
17 |
return("Test update results func")
|
18 |
-
|
19 |
-
|
20 |
|
21 |
with gr.Blocks(title=title) as demo:
|
22 |
gr.Markdown(f"## {title}")
|
@@ -36,10 +36,4 @@ with gr.Blocks(title=title) as demo:
|
|
36 |
response_display = gr.Markdown("Empty")
|
37 |
|
38 |
submit_button.click(fn=fn, inputs=[text_area,number_to_display], outputs=[response_display])
|
39 |
-
demo.launch(max_threads=40)
|
40 |
-
#iface = gr.Interface(fn=partial(update_results),
|
41 |
-
# inputs=gr.Textbox(lines=3, label="Décrivez votre situation avec vos mots (histoire, mots clés, sujet etc...)"),
|
42 |
-
# outputs=gr.Markdown(label="Résultats: Hadiths les plus pertinent par rapport à votre situation"),
|
43 |
-
# title=title,
|
44 |
-
# description=desc + warning)
|
45 |
-
#iface.queue(max_size=20).launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
from get_similar_hadiths import HadithSearch
|
3 |
import os
|
4 |
from functools import partial
|
5 |
|
6 |
+
hadith_search = HadithSearch(api_key=os.environ.get("apk"))
|
7 |
+
hadith_search.load_data_from_json("embeded_data.json")
|
8 |
|
9 |
title = "Smart Hadith -> English version available here:https://huggingface.co/spaces/Adr740/Hadith_AI_Explorer"
|
10 |
desc = "Bienvenue dans Smart Hadith. Expliquer une situation ou un problème (peronnel ou non) et Smart Hadith va retrouver des hadith qui peuvent potentiellement vous aider. Contact suggestions/questions: [[email protected]](mailto:[email protected])"
|
|
|
15 |
user_input = text_area
|
16 |
print(user_input, number_to_display)
|
17 |
return("Test update results func")
|
18 |
+
results = hadith_search.search_hadiths(user_input, number_to_display)
|
19 |
+
return results
|
20 |
|
21 |
with gr.Blocks(title=title) as demo:
|
22 |
gr.Markdown(f"## {title}")
|
|
|
36 |
response_display = gr.Markdown("Empty")
|
37 |
|
38 |
submit_button.click(fn=fn, inputs=[text_area,number_to_display], outputs=[response_display])
|
39 |
+
demo.launch(max_threads=40)
|
|
|
|
|
|
|
|
|
|
|
|