update(3)
Browse files
app.py
CHANGED
|
@@ -59,10 +59,21 @@ def run_save(current_state):
|
|
| 59 |
|
| 60 |
# --- 3. Define the Gradio UI ---
|
| 61 |
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 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)
|