broadfield-dev commited on
Commit
69be800
·
verified ·
1 Parent(s): b6818ca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -259,7 +259,8 @@ def process_input(gif_file, max_images, size, tool, lower_bound, upper_bound, pa
259
  )
260
 
261
  return report, results, gif_path, preview, len(frames)
262
-
 
263
  # Gradio Blocks interface
264
  with gr.Blocks(title="Solar CME Detection") as demo:
265
  gr.Markdown("""
@@ -288,13 +289,19 @@ with gr.Blocks(title="Solar CME Detection") as demo:
288
  with gr.Row():
289
  with gr.Column():
290
  gr.Markdown("### Input Options")
 
291
  gif_input = gr.File(label="Upload Solar GIF (optional)", file_types=[".gif"])
292
  max_images = gr.Slider(minimum=1, maximum=100, value=10, step=1, label="Max Images to Fetch")
293
  size = gr.Textbox(label="Image Size", value="1024by960")
294
  tool = gr.Textbox(label="Instrument", value="ccor1")
295
  fetch_button = gr.Button("Fetch Images from URL")
296
  analyze_button = gr.Button("Analyze")
297
-
 
 
 
 
 
298
  with gr.Column():
299
  gr.Markdown("### Outputs")
300
  report = gr.Textbox(label="Analysis Report", lines=10)
 
259
  )
260
 
261
  return report, results, gif_path, preview, len(frames)
262
+ def load_demo():
263
+ return "https://huggingface.co/spaces/broadfield-dev/detect-cme/resolve/main/demo_gif.gif"
264
  # Gradio Blocks interface
265
  with gr.Blocks(title="Solar CME Detection") as demo:
266
  gr.Markdown("""
 
289
  with gr.Row():
290
  with gr.Column():
291
  gr.Markdown("### Input Options")
292
+ demo_btn = gr.Button("Load Demo")
293
  gif_input = gr.File(label="Upload Solar GIF (optional)", file_types=[".gif"])
294
  max_images = gr.Slider(minimum=1, maximum=100, value=10, step=1, label="Max Images to Fetch")
295
  size = gr.Textbox(label="Image Size", value="1024by960")
296
  tool = gr.Textbox(label="Instrument", value="ccor1")
297
  fetch_button = gr.Button("Fetch Images from URL")
298
  analyze_button = gr.Button("Analyze")
299
+
300
+ demo_btn.click(
301
+ fn=load_demo,
302
+ inputs=[],
303
+ outputs=[report, preview, fetched_frames_state, total_images]
304
+ )
305
  with gr.Column():
306
  gr.Markdown("### Outputs")
307
  report = gr.Textbox(label="Analysis Report", lines=10)