File size: 1,493 Bytes
33b5718
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import gradio as gr
from summarization import summarize_text
from flashcards import generate_flashcards
from mind_map import generate_mind_map
from quiz_generator import generate_quiz

with gr.Blocks() as demo:
    gr.Markdown("# AI Study Assistant")
    
    with gr.Tab("تلخيص"):
        gr.Interface(
            fn=summarize_text,
            inputs=[
                gr.Textbox(lines=10, placeholder="أدخل النص هنا..."),
                gr.Radio(["مختصر", "متوسط", "تفصيلي"], label="مستوى التلخيص")
            ],
            outputs="text"
        ).render()
    
    with gr.Tab("كروت دراسية"):
        gr.Interface(
            fn=generate_flashcards,
            inputs=gr.Textbox(lines=10, placeholder="أدخل النص هنا..."),
            outputs="json"
        ).render()
    
    with gr.Tab("خريطة ذهنية"):
        gr.Interface(
            fn=generate_mind_map,
            inputs=gr.Textbox(lines=10, placeholder="أدخل المحاضرة هنا..."),
            outputs="text"
        ).render()
    
    with gr.Tab("اختبار"):
        gr.Interface(
            fn=generate_quiz,
            inputs=[
                gr.Textbox(lines=10, placeholder="أدخل المحاضرة هنا..."),
                gr.Dropdown(["اختيار من متعدد", "صح/خطأ", "ملء الفراغات"], label="نوع السؤال")
            ],
            outputs="text"
        ).render()

demo.launch()