Batnini commited on
Commit
a486f87
·
verified ·
1 Parent(s): e40ecdd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -12
app.py CHANGED
@@ -22,18 +22,36 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
22
  gr.Markdown("# <center>منظومة الأدوات العربية</center>")
23
 
24
  with gr.Tab("🖊️ مولد النصوص"):
25
- # ... (keep your existing Arabic generator UI) ...
 
 
 
 
 
 
 
 
 
 
 
 
26
 
27
  with gr.Tab("📖 البحث القرآني"):
28
- gr.Markdown("## بحث دلالي في القرآن الكريم")
29
-
30
  with gr.Row():
31
  with gr.Column():
32
- search_input = gr.Textbox(label="موضوع البحث", placeholder="اكتب موضوع البحث هنا...")
33
- top_k = gr.Slider(1, 10, value=5, step=1, label="عدد النتائج")
34
  search_btn = gr.Button("ابحث", variant="primary")
35
  search_output = gr.Markdown()
36
 
 
 
 
 
 
 
 
37
  # Examples section
38
  with gr.Accordion("أمثلة بحثية", open=False):
39
  gr.Examples(
@@ -45,13 +63,6 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
45
  inputs=[search_input, top_k],
46
  label="اضغط على مثال لتحميله"
47
  )
48
-
49
- # Connect Quran search button
50
- search_btn.click(
51
- fn=lambda q, k: format_quran_results(quran_searcher.search(q, k)),
52
- inputs=[search_input, top_k],
53
- outputs=search_output
54
- )
55
 
56
  if __name__ == "__main__":
57
  app.launch()
 
22
  gr.Markdown("# <center>منظومة الأدوات العربية</center>")
23
 
24
  with gr.Tab("🖊️ مولد النصوص"):
25
+ # Arabic Generator UI
26
+ with gr.Row():
27
+ with gr.Column():
28
+ text_input = gr.Textbox(label="النص الأولي")
29
+ length_slider = gr.Slider(50, 300, value=100, label="طول النص")
30
+ gen_btn = gr.Button("توليد", variant="primary")
31
+ text_output = gr.Textbox(label="النص المولد", lines=8)
32
+
33
+ gen_btn.click(
34
+ text_gen.generate,
35
+ inputs=[text_input, length_slider],
36
+ outputs=text_output
37
+ )
38
 
39
  with gr.Tab("📖 البحث القرآني"):
40
+ # Quran Search UI
 
41
  with gr.Row():
42
  with gr.Column():
43
+ search_input = gr.Textbox(label="موضوع البحث")
44
+ top_k = gr.Slider(1, 10, value=5, label="عدد النتائج")
45
  search_btn = gr.Button("ابحث", variant="primary")
46
  search_output = gr.Markdown()
47
 
48
+ # Connect search button
49
+ search_btn.click(
50
+ lambda q, k: format_quran_results(quran_searcher.search(q, k)),
51
+ inputs=[search_input, top_k],
52
+ outputs=search_output
53
+ )
54
+
55
  # Examples section
56
  with gr.Accordion("أمثلة بحثية", open=False):
57
  gr.Examples(
 
63
  inputs=[search_input, top_k],
64
  label="اضغط على مثال لتحميله"
65
  )
 
 
 
 
 
 
 
66
 
67
  if __name__ == "__main__":
68
  app.launch()