Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -70,7 +70,6 @@ with gr.Blocks() as demo:
|
|
70 |
# Section for generating Text-based output (lesson, question, feedback)
|
71 |
with gr.Row():
|
72 |
with gr.Column(scale=2):
|
73 |
-
# Input fields for subject, difficulty, and student input for textual output
|
74 |
subject = gr.Dropdown(
|
75 |
["Math", "Science", "History", "Literature", "Code", "AI"],
|
76 |
label="Subject",
|
@@ -89,7 +88,6 @@ with gr.Blocks() as demo:
|
|
89 |
submit_button_text = gr.Button("Generate Lesson & Question", variant="primary")
|
90 |
|
91 |
with gr.Column(scale=3):
|
92 |
-
# Output fields for lesson, question, and feedback
|
93 |
lesson_output = gr.Markdown(label="Lesson")
|
94 |
question_output = gr.Markdown(label="Comprehension Question")
|
95 |
feedback_output = gr.Markdown(label="Feedback")
|
@@ -97,7 +95,6 @@ with gr.Blocks() as demo:
|
|
97 |
# Section for generating Visual output
|
98 |
with gr.Row():
|
99 |
with gr.Column(scale=2):
|
100 |
-
# Input fields for text and model selection for image generation
|
101 |
model_selector = gr.Radio(
|
102 |
["Model 1 (Turbo Realism)", "Model 2 (Face Projection)"],
|
103 |
label="Select Image Generation Model",
|
@@ -106,7 +103,6 @@ with gr.Blocks() as demo:
|
|
106 |
submit_button_visual = gr.Button("Generate Visuals", variant="primary")
|
107 |
|
108 |
with gr.Column(scale=3):
|
109 |
-
# Output fields for generated images
|
110 |
output1 = gr.Image(label="Generated Image 1")
|
111 |
output2 = gr.Image(label="Generated Image 2")
|
112 |
output3 = gr.Image(label="Generated Image 3")
|
@@ -128,19 +124,17 @@ with gr.Blocks() as demo:
|
|
128 |
|
129 |
def process_output_visual(text, selected_model):
|
130 |
try:
|
131 |
-
images = generate_images(text, selected_model)
|
132 |
return images[0], images[1], images[2]
|
133 |
except:
|
134 |
return None, None, None
|
135 |
|
136 |
-
# Generate Text-based Output
|
137 |
submit_button_text.click(
|
138 |
fn=process_output_text,
|
139 |
inputs=[subject, difficulty, student_input],
|
140 |
outputs=[lesson_output, question_output, feedback_output]
|
141 |
)
|
142 |
|
143 |
-
# Generate Visual Output
|
144 |
submit_button_visual.click(
|
145 |
fn=process_output_visual,
|
146 |
inputs=[student_input, model_selector],
|
|
|
70 |
# Section for generating Text-based output (lesson, question, feedback)
|
71 |
with gr.Row():
|
72 |
with gr.Column(scale=2):
|
|
|
73 |
subject = gr.Dropdown(
|
74 |
["Math", "Science", "History", "Literature", "Code", "AI"],
|
75 |
label="Subject",
|
|
|
88 |
submit_button_text = gr.Button("Generate Lesson & Question", variant="primary")
|
89 |
|
90 |
with gr.Column(scale=3):
|
|
|
91 |
lesson_output = gr.Markdown(label="Lesson")
|
92 |
question_output = gr.Markdown(label="Comprehension Question")
|
93 |
feedback_output = gr.Markdown(label="Feedback")
|
|
|
95 |
# Section for generating Visual output
|
96 |
with gr.Row():
|
97 |
with gr.Column(scale=2):
|
|
|
98 |
model_selector = gr.Radio(
|
99 |
["Model 1 (Turbo Realism)", "Model 2 (Face Projection)"],
|
100 |
label="Select Image Generation Model",
|
|
|
103 |
submit_button_visual = gr.Button("Generate Visuals", variant="primary")
|
104 |
|
105 |
with gr.Column(scale=3):
|
|
|
106 |
output1 = gr.Image(label="Generated Image 1")
|
107 |
output2 = gr.Image(label="Generated Image 2")
|
108 |
output3 = gr.Image(label="Generated Image 3")
|
|
|
124 |
|
125 |
def process_output_visual(text, selected_model):
|
126 |
try:
|
127 |
+
images = generate_images(text, selected_model)
|
128 |
return images[0], images[1], images[2]
|
129 |
except:
|
130 |
return None, None, None
|
131 |
|
|
|
132 |
submit_button_text.click(
|
133 |
fn=process_output_text,
|
134 |
inputs=[subject, difficulty, student_input],
|
135 |
outputs=[lesson_output, question_output, feedback_output]
|
136 |
)
|
137 |
|
|
|
138 |
submit_button_visual.click(
|
139 |
fn=process_output_visual,
|
140 |
inputs=[student_input, model_selector],
|