Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -91,17 +91,19 @@ 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(video_path):
95
  """
96
  This single function runs your entire workflow.
97
- Gradio will pass the user's uploaded video path to this function.
98
  """
99
  if not all([GOOGLE_API_KEY, ELEVENLABS_API_KEY, LLAMA_405B_KEY, llama_client]):
100
- raise gr.Error("API keys are not configured. The app admin needs to set the secrets.")
101
 
102
  try:
103
- # --- Step 0: Read the uploaded video file ---
104
- video_bytes = open(video_path, 'rb').read()
 
 
105
  except Exception as e:
106
  raise gr.Error(f"Failed to read video file: {e}")
107
 
@@ -201,7 +203,7 @@ demo = gr.Interface(
201
  fn=generate_sfx, # The main function to call
202
 
203
  # Input component: A video uploader
204
- inputs=gr.Video(label="Upload Your Video Clip"),
205
 
206
  # Output components: A list matching the function's return values
207
  outputs=[
 
91
 
92
 
93
  # --- 3. The Main Workflow Function for Gradio ---
94
+ def generate_sfx(video_file_object):
95
  """
96
  This single function runs your entire workflow.
97
+ Gradio will pass the user's uploaded video as a file object.
98
  """
99
  if not all([GOOGLE_API_KEY, ELEVENLABS_API_KEY, LLAMA_405B_KEY, llama_client]):
100
+ raise gr.Error("API keys are not configured...")
101
 
102
  try:
103
+ # --- THIS IS THE NEW, FIXED LINE ---
104
+ # We now read directly from the file object's path
105
+ with open(video_file_object.name, 'rb') as f:
106
+ video_bytes = f.read()
107
  except Exception as e:
108
  raise gr.Error(f"Failed to read video file: {e}")
109
 
 
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", type="file"),
207
 
208
  # Output components: A list matching the function's return values
209
  outputs=[