Update app.py
Browse files
app.py
CHANGED
@@ -309,4 +309,24 @@ with gr.Blocks() as app:
|
|
309 |
aiornot2, [inp], [outp2, n_out2]).then(
|
310 |
tot_prob, None, fin, show_progress=False)
|
311 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
312 |
app.launch(show_api=False, max_threads=24)
|
|
|
309 |
aiornot2, [inp], [outp2, n_out2]).then(
|
310 |
tot_prob, None, fin, show_progress=False)
|
311 |
|
312 |
+
# Tab for batch processing
|
313 |
+
with gr.Tab("Batch Image Processing"):
|
314 |
+
zip_file = gr.File(label="Upload Zip (two folders: real, ai)")
|
315 |
+
batch_btn = gr.Button("Process Batch")
|
316 |
+
|
317 |
+
for i, model in enumerate(models):
|
318 |
+
with gr.Group():
|
319 |
+
gr.Markdown(f"### Results for {model}")
|
320 |
+
globals()[f'output_acc{i}'] = gr.Label(label=f"Model {i} Accuracy")
|
321 |
+
globals()[f'output_roc{i}'] = gr.Label(label=f"Model {i} ROC Score")
|
322 |
+
globals()[f'output_report{i}'] = gr.Textbox(label=f"Model {i} Classification Report", lines=10)
|
323 |
+
globals()[f'output_cm{i}'] = gr.Plot(label=f"Model {i} Confusion Matrix")
|
324 |
+
globals()[f'output_roc_plot{i}'] = gr.Plot(label=f"Model {i} ROC Curve")
|
325 |
+
|
326 |
+
# Connect batch processing
|
327 |
+
batch_btn.click(process_zip, zip_file,
|
328 |
+
[output_acc0, output_roc0, output_report0, output_cm0, output_roc_plot0,
|
329 |
+
output_acc1, output_roc1, output_report1, output_cm1, output_roc_plot1,
|
330 |
+
output_acc2, output_roc2, output_report2, output_cm2, output_roc_plot2])
|
331 |
+
|
332 |
app.launch(show_api=False, max_threads=24)
|