cmckinle commited on
Commit
4cbdf2f
·
verified ·
1 Parent(s): 1e15008

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -4
app.py CHANGED
@@ -280,7 +280,7 @@ detector = AIDetector()
280
 
281
  def create_gradio_interface():
282
  with gr.Blocks() as app:
283
- gr.Markdown("""<center><h1>AI Image Detector<br><h4>(Demo)</h4></h1></center>""")
284
 
285
  with gr.Tabs():
286
  with gr.Tab("Single Image Detection"):
@@ -300,12 +300,12 @@ def create_gradio_interface():
300
 
301
  with gr.Tab("Batch Image Processing"):
302
  zip_file = gr.File(
303
- label="Upload Zip (Zip file must contain 2 folders, one labeled 'real' and one labled 'ai' )",
304
  file_types=[".zip"],
305
  file_count="single",
306
- max_file_size=1024 # Increased to 1024 MB (1 GB)
307
  )
308
- batch_btn = gr.Button("Process Batch")
309
 
310
  with gr.Group():
311
  gr.Markdown(f"### Results for {MODEL_NAME}")
@@ -322,6 +322,15 @@ def create_gradio_interface():
322
  [output_html, output_label]
323
  )
324
 
 
 
 
 
 
 
 
 
 
325
  batch_btn.click(
326
  process_zip,
327
  zip_file,
 
280
 
281
  def create_gradio_interface():
282
  with gr.Blocks() as app:
283
+ gr.Markdown("""<center><h1>AI Image Detector<br><h4>(Test Demo - accuracy varies by model)</h4></h1></center>""")
284
 
285
  with gr.Tabs():
286
  with gr.Tab("Single Image Detection"):
 
300
 
301
  with gr.Tab("Batch Image Processing"):
302
  zip_file = gr.File(
303
+ label="Upload Zip (must contain 'real' and 'ai' folders)",
304
  file_types=[".zip"],
305
  file_count="single",
306
+ max_file_size=1024 # 1024 MB (1 GB)
307
  )
308
+ batch_btn = gr.Button("Process Batch", interactive=False)
309
 
310
  with gr.Group():
311
  gr.Markdown(f"### Results for {MODEL_NAME}")
 
322
  [output_html, output_label]
323
  )
324
 
325
+ def enable_batch_btn(file):
326
+ return gr.Button.update(interactive=file is not None)
327
+
328
+ zip_file.upload(
329
+ enable_batch_btn,
330
+ zip_file,
331
+ batch_btn
332
+ )
333
+
334
  batch_btn.click(
335
  process_zip,
336
  zip_file,