Spaces:
Sleeping
Sleeping
Update app.py 2
#2
by
Ken3659029
- opened
app.py
CHANGED
|
@@ -91,7 +91,7 @@ Produce a single, continuous, structured description following all the above rul
|
|
| 91 |
|
| 92 |
|
| 93 |
# --- 3. The Main Workflow Function for Gradio ---
|
| 94 |
-
def generate_sfx(
|
| 95 |
"""
|
| 96 |
This single function runs your entire workflow.
|
| 97 |
Gradio will pass the user's uploaded video as a file object.
|
|
@@ -102,8 +102,7 @@ def generate_sfx(video_file_object):
|
|
| 102 |
try:
|
| 103 |
# --- THIS IS THE NEW, FIXED LINE ---
|
| 104 |
# We now read directly from the file object's path
|
| 105 |
-
|
| 106 |
-
video_bytes = f.read()
|
| 107 |
except Exception as e:
|
| 108 |
raise gr.Error(f"Failed to read video file: {e}")
|
| 109 |
|
|
@@ -203,7 +202,7 @@ demo = gr.Interface(
|
|
| 203 |
fn=generate_sfx, # The main function to call
|
| 204 |
|
| 205 |
# Input component: A video uploader
|
| 206 |
-
inputs=gr.Video(label="Upload Your Video Clip"
|
| 207 |
|
| 208 |
# Output components: A list matching the function's return values
|
| 209 |
outputs=[
|
|
@@ -215,8 +214,6 @@ demo = gr.Interface(
|
|
| 215 |
title="🎬 AI Video-to-Sound-Effect Workflow",
|
| 216 |
description="Upload a video. The app will: 1. Transcribe visuals (Gemini). 2. Create SFX prompts (Llama). 3. Generate audio (ElevenLabs).",
|
| 217 |
allow_flagging="never",
|
| 218 |
-
# We can use your 'deadpool 3.mp4' as an example if it's in the same folder
|
| 219 |
-
examples=[["deadpool 3.mp4"]]
|
| 220 |
)
|
| 221 |
|
| 222 |
# --- 6. Launch the App ---
|
|
|
|
| 91 |
|
| 92 |
|
| 93 |
# --- 3. The Main Workflow Function for Gradio ---
|
| 94 |
+
def generate_sfx(video_path):
|
| 95 |
"""
|
| 96 |
This single function runs your entire workflow.
|
| 97 |
Gradio will pass the user's uploaded video as a file object.
|
|
|
|
| 102 |
try:
|
| 103 |
# --- THIS IS THE NEW, FIXED LINE ---
|
| 104 |
# We now read directly from the file object's path
|
| 105 |
+
video_bytes = open(video_path, 'rb').read()
|
|
|
|
| 106 |
except Exception as e:
|
| 107 |
raise gr.Error(f"Failed to read video file: {e}")
|
| 108 |
|
|
|
|
| 202 |
fn=generate_sfx, # The main function to call
|
| 203 |
|
| 204 |
# Input component: A video uploader
|
| 205 |
+
inputs=gr.Video(label="Upload Your Video Clip"),
|
| 206 |
|
| 207 |
# Output components: A list matching the function's return values
|
| 208 |
outputs=[
|
|
|
|
| 214 |
title="🎬 AI Video-to-Sound-Effect Workflow",
|
| 215 |
description="Upload a video. The app will: 1. Transcribe visuals (Gemini). 2. Create SFX prompts (Llama). 3. Generate audio (ElevenLabs).",
|
| 216 |
allow_flagging="never",
|
|
|
|
|
|
|
| 217 |
)
|
| 218 |
|
| 219 |
# --- 6. Launch the App ---
|