kaiku03 commited on
Commit
e69488e
·
1 Parent(s): 1665e9d
Files changed (1) hide show
  1. app.py +15 -4
app.py CHANGED
@@ -59,10 +59,21 @@ def run_save(current_state):
59
 
60
  # --- 3. Define the Gradio UI ---
61
 
62
- example_list = [
63
- ["examples/your_audio_file.wav", None],
64
- [None, "examples/your_image_file.jpg"],
65
- ]
 
 
 
 
 
 
 
 
 
 
 
66
 
67
  with gr.Blocks(theme=gr.themes.Soft(), title="Multimodal News Reporter") as demo:
68
  agent_state = gr.State(value=None)
 
59
 
60
  # --- 3. Define the Gradio UI ---
61
 
62
+ # Define known file extensions
63
+ AUDIO_EXTENSIONS = ['.wav', '.mp3', '.m4a', '.flac']
64
+ IMAGE_EXTENSIONS = ['.jpg', '.jpeg', '.png', '.webp', '.gif']
65
+
66
+ # Dynamically build the example list
67
+ example_list = []
68
+ for filename in os.listdir("examples"):
69
+ filepath = os.path.join("examples", filename)
70
+ # Check if it's an audio file
71
+ if any(filename.lower().endswith(ext) for ext in AUDIO_EXTENSIONS):
72
+ example_list.append([filepath, None])
73
+ # Check if it's an image file
74
+ elif any(filename.lower().endswith(ext) for ext in IMAGE_EXTENSIONS):
75
+ example_list.append([None, filepath])
76
+
77
 
78
  with gr.Blocks(theme=gr.themes.Soft(), title="Multimodal News Reporter") as demo:
79
  agent_state = gr.State(value=None)