Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -259,7 +259,7 @@ 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 |
-
def
|
263 |
gif_file="./demo_gif.gif"
|
264 |
if gif_file:
|
265 |
frames, error = extract_frames(gif_file)
|
@@ -279,6 +279,23 @@ def load_demo(gif_file, max_images, size, tool, lower_bound, upper_bound, param1
|
|
279 |
)
|
280 |
|
281 |
return report, results, gif_path, preview, len(frames)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
282 |
# Gradio Blocks interface
|
283 |
with gr.Blocks(title="Solar CME Detection") as demo:
|
284 |
gr.Markdown("""
|
@@ -336,10 +353,7 @@ with gr.Blocks(title="Solar CME Detection") as demo:
|
|
336 |
|
337 |
demo_btn.click(
|
338 |
fn=load_demo,
|
339 |
-
inputs=[
|
340 |
-
gif_input, max_images, size, tool,
|
341 |
-
lower_bound, upper_bound, param1, param2, center_tolerance, morph_iterations, min_rad, display_mode, fetched_frames_state
|
342 |
-
],
|
343 |
outputs=[report, preview, fetched_frames_state, total_images]
|
344 |
)
|
345 |
# Analyze button action
|
|
|
259 |
)
|
260 |
|
261 |
return report, results, gif_path, preview, len(frames)
|
262 |
+
def load_demo_2(gif_file, max_images, size, tool, lower_bound, upper_bound, param1, param2, center_tolerance, morph_iterations, min_rad, display_mode, fetched_frames_state):
|
263 |
gif_file="./demo_gif.gif"
|
264 |
if gif_file:
|
265 |
frames, error = extract_frames(gif_file)
|
|
|
279 |
)
|
280 |
|
281 |
return report, results, gif_path, preview, len(frames)
|
282 |
+
|
283 |
+
def load_demo():
|
284 |
+
gif_file="./demo_gif.gif"
|
285 |
+
if gif_file:
|
286 |
+
frames, error = extract_frames(gif_file)
|
287 |
+
if error:
|
288 |
+
return error, [], None, [], 0
|
289 |
+
else:
|
290 |
+
frames = fetched_frames_state
|
291 |
+
if not frames:
|
292 |
+
return "No fetched frames available. Please fetch images first.", [], None, [], 0
|
293 |
+
preview = [Image.fromarray(frame) for frame in frames] if frames else []
|
294 |
+
|
295 |
+
|
296 |
+
|
297 |
+
return report, [], None, preview, len(frames)
|
298 |
+
|
299 |
# Gradio Blocks interface
|
300 |
with gr.Blocks(title="Solar CME Detection") as demo:
|
301 |
gr.Markdown("""
|
|
|
353 |
|
354 |
demo_btn.click(
|
355 |
fn=load_demo,
|
356 |
+
inputs=[],
|
|
|
|
|
|
|
357 |
outputs=[report, preview, fetched_frames_state, total_images]
|
358 |
)
|
359 |
# Analyze button action
|