Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,5 @@
|
|
1 |
-
# app.py
|
2 |
-
|
3 |
import gradio as gr
|
4 |
-
from utils import generate_tutor_output
|
5 |
|
6 |
with gr.Blocks() as demo:
|
7 |
gr.Markdown("# 🎓 Your AI Tutor by Farhan")
|
@@ -47,18 +45,9 @@ with gr.Blocks() as demo:
|
|
47 |
5. Review the AI-generated content to enhance your learning.
|
48 |
6. Feel free to ask follow-up questions or explore new topics!
|
49 |
""")
|
50 |
-
|
51 |
-
# Function to process and extract the JSON response
|
52 |
-
def process_output(output):
|
53 |
-
try:
|
54 |
-
parsed = eval(output)
|
55 |
-
return parsed["lesson"], parsed["question"], parsed["feedback"]
|
56 |
-
except:
|
57 |
-
return "Error parsing output", "No question available", "No feedback available"
|
58 |
-
|
59 |
-
# Define the interaction between user inputs and generated outputs
|
60 |
submit_button.click(
|
61 |
-
fn=lambda s, d, i, m:
|
62 |
inputs=[subject, difficulty, student_input, model],
|
63 |
outputs=[lesson_output, question_output, feedback_output, image_output]
|
64 |
)
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
from utils import generate_tutor_output, generate_visual_answer
|
3 |
|
4 |
with gr.Blocks() as demo:
|
5 |
gr.Markdown("# 🎓 Your AI Tutor by Farhan")
|
|
|
45 |
5. Review the AI-generated content to enhance your learning.
|
46 |
6. Feel free to ask follow-up questions or explore new topics!
|
47 |
""")
|
48 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
submit_button.click(
|
50 |
+
fn=lambda s, d, i, m: (generate_tutor_output(s, d, i, m), generate_visual_answer(i)),
|
51 |
inputs=[subject, difficulty, student_input, model],
|
52 |
outputs=[lesson_output, question_output, feedback_output, image_output]
|
53 |
)
|