Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -146,6 +146,12 @@ def process_files(csv_file, openai_key, user_aspek=default_user_aspek, pdf_file=
|
|
146 |
except Exception as e:
|
147 |
return f"Error occurred: {str(e)}\nType: {type(e)}"
|
148 |
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
# Create Gradio interface
|
150 |
def create_interface():
|
151 |
with gr.Blocks(title="Quiz Evaluator", theme=gr.themes.Soft()) as app:
|
@@ -168,6 +174,17 @@ def create_interface():
|
|
168 |
label="Reference Material (PDF)",
|
169 |
file_types=[".pdf"]
|
170 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
|
172 |
user_aspek = gr.Textbox(
|
173 |
label="Aspek",
|
|
|
146 |
except Exception as e:
|
147 |
return f"Error occurred: {str(e)}\nType: {type(e)}"
|
148 |
|
149 |
+
def load_demo_files(checked):
|
150 |
+
if checked:
|
151 |
+
return gr.update(value="./demo.csv"), gr.update(value="./demo.pdf")
|
152 |
+
else:
|
153 |
+
return gr.update(value=None), gr.update(value=None)
|
154 |
+
|
155 |
# Create Gradio interface
|
156 |
def create_interface():
|
157 |
with gr.Blocks(title="Quiz Evaluator", theme=gr.themes.Soft()) as app:
|
|
|
174 |
label="Reference Material (PDF)",
|
175 |
file_types=[".pdf"]
|
176 |
)
|
177 |
+
|
178 |
+
demo_checkbox = gr.Checkbox(
|
179 |
+
label="Use Demo Files",
|
180 |
+
value=False
|
181 |
+
)
|
182 |
+
|
183 |
+
demo_checkbox.change(
|
184 |
+
fn=load_demo_files,
|
185 |
+
inputs=[demo_checkbox],
|
186 |
+
outputs=[csv_input, pdf_input]
|
187 |
+
)
|
188 |
|
189 |
user_aspek = gr.Textbox(
|
190 |
label="Aspek",
|