File size: 2,095 Bytes
a14fe7d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e6e5688
 
 
a14fe7d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
45
46
47
48
49
50
51
52
53
import gradio as gr

# Define learning paths and corresponding content
learning_paths = {
    "Math": "Welcome to the Math path! Solve problems and explore concepts like algebra, calculus, and geometry.",
    "Science & Engineering": "Dive into physics, chemistry, and engineering concepts with interactive examples.",
    "Computer Science & Programming": "Learn programming, algorithms, and computer science fundamentals.",
    "Data Science & Data Analysis": "Master data manipulation, visualization, and analysis techniques."
}

# Function to display the selected learning path's content
def show_learning_content(selected_path):
    """
    Displays content for the selected learning path.
    """
    return f"You selected: {selected_path}\n\n{learning_paths[selected_path]}"

# Function to simulate feedback or progression
def provide_feedback(selected_path):
    return f"Great choice! Let's dive into {selected_path}."

# Gradio interface
with gr.Blocks() as app:
    gr.Markdown("## Interactive Learning Platform")
    gr.Markdown("Choose a topic to start learning:")
    
    # Progress bar at the top (HTML-based)
    gr.HTML('<div style="width: 100%; background-color: lightgray; height: 5px; border-radius: 5px;">'
            '<div style="width: 25%; background-color: green; height: 100%;"></div></div>')
    
    # Options for learning paths
    selected_topic = gr.Radio(
        choices=list(learning_paths.keys()),
        label="Select a Learning Path",
        value="Math"
    )
    
    # Buttons for user interaction
    with gr.Row():
        continue_button = gr.Button("Continue")
        feedback_button = gr.Button("Get Feedback")

    # Outputs
    learning_output = gr.Textbox(lines=8, interactive=False, label="Learning Content")
    feedback_output = gr.Textbox(interactive=False, label="Feedback")

    # Link interactions to actions
    continue_button.click(fn=show_learning_content, inputs=selected_topic, outputs=learning_output)
    feedback_button.click(fn=provide_feedback, inputs=selected_topic, outputs=feedback_output)

# Launch the app
app.launch()