Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from summarization import summarize_text
|
| 3 |
+
from flashcards import generate_flashcards
|
| 4 |
+
from mind_map import generate_mind_map
|
| 5 |
+
from quiz_generator import generate_quiz
|
| 6 |
+
|
| 7 |
+
with gr.Blocks() as demo:
|
| 8 |
+
gr.Markdown("# AI Study Assistant")
|
| 9 |
+
|
| 10 |
+
with gr.Tab("تلخيص"):
|
| 11 |
+
gr.Interface(
|
| 12 |
+
fn=summarize_text,
|
| 13 |
+
inputs=[
|
| 14 |
+
gr.Textbox(lines=10, placeholder="أدخل النص هنا..."),
|
| 15 |
+
gr.Radio(["مختصر", "متوسط", "تفصيلي"], label="مستوى التلخيص")
|
| 16 |
+
],
|
| 17 |
+
outputs="text"
|
| 18 |
+
).render()
|
| 19 |
+
|
| 20 |
+
with gr.Tab("كروت دراسية"):
|
| 21 |
+
gr.Interface(
|
| 22 |
+
fn=generate_flashcards,
|
| 23 |
+
inputs=gr.Textbox(lines=10, placeholder="أدخل النص هنا..."),
|
| 24 |
+
outputs="json"
|
| 25 |
+
).render()
|
| 26 |
+
|
| 27 |
+
with gr.Tab("خريطة ذهنية"):
|
| 28 |
+
gr.Interface(
|
| 29 |
+
fn=generate_mind_map,
|
| 30 |
+
inputs=gr.Textbox(lines=10, placeholder="أدخل المحاضرة هنا..."),
|
| 31 |
+
outputs="text"
|
| 32 |
+
).render()
|
| 33 |
+
|
| 34 |
+
with gr.Tab("اختبار"):
|
| 35 |
+
gr.Interface(
|
| 36 |
+
fn=generate_quiz,
|
| 37 |
+
inputs=[
|
| 38 |
+
gr.Textbox(lines=10, placeholder="أدخل المحاضرة هنا..."),
|
| 39 |
+
gr.Dropdown(["اختيار من متعدد", "صح/خطأ", "ملء الفراغات"], label="نوع السؤال")
|
| 40 |
+
],
|
| 41 |
+
outputs="text"
|
| 42 |
+
).render()
|
| 43 |
+
|
| 44 |
+
demo.launch()
|