jschwab21 commited on
Commit
7320afb
·
verified ·
1 Parent(s): d1268c3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -10
app.py CHANGED
@@ -68,21 +68,24 @@ def save_uploaded_file(uploaded_file):
68
 
69
  def display_results(video_url, video_file, description):
70
  """Process video from URL or file upload and return the results."""
71
- final_clip_path = None
72
-
73
  if video_url:
74
- final_clip_path = process_video(video_url, description, is_url=True)
 
 
75
  elif video_file:
 
76
  video_file_path = save_uploaded_file(video_file)
77
  if video_file_path:
78
- final_clip_path = process_video(video_file_path, description, is_url=False)
 
 
79
  else:
 
80
  return "No file provided or file save error", None
81
-
82
- if final_clip_path:
83
- return final_clip_path, final_clip_path # Returning the path twice, for both video and download components
84
  else:
85
- return "No matching scene found", None
 
86
 
87
  css = """
88
  body {
@@ -139,8 +142,8 @@ with gr.Blocks() as demo:
139
  video_file = gr.UploadButton(label="Upload Video File", type="binary", file_types=["video"])
140
  description = gr.Textbox(label="Describe your clip")
141
  submit_button = gr.Button("Process Video")
142
- video_output = gr.Video(label="Processed Video")
143
- download_output = gr.File(label="Download Processed Video")
144
  submit_button.click(
145
  fn=display_results,
146
  inputs=[video_url, video_file, description],
 
68
 
69
  def display_results(video_url, video_file, description):
70
  """Process video from URL or file upload and return the results."""
71
+ print("Function called with:", video_url, video_file, description)
 
72
  if video_url:
73
+ print("Processing video from URL.")
74
+ # Simplified for testing: Just simulate processing and return a URL.
75
+ return "Processed video URL would be here", "Dummy video URL for testing"
76
  elif video_file:
77
+ print("Received video file for processing.")
78
  video_file_path = save_uploaded_file(video_file)
79
  if video_file_path:
80
+ print(f"Video file saved to: {video_file_path}")
81
+ # Simplified for testing
82
+ return "Processed video file would be here", "Dummy video file path for testing"
83
  else:
84
+ print("No file provided or file save error.")
85
  return "No file provided or file save error", None
 
 
 
86
  else:
87
+ print("No valid input received.")
88
+ return "No input received", None
89
 
90
  css = """
91
  body {
 
142
  video_file = gr.UploadButton(label="Upload Video File", type="binary", file_types=["video"])
143
  description = gr.Textbox(label="Describe your clip")
144
  submit_button = gr.Button("Process Video")
145
+ video_output = gr.Text(label="Processed Video")
146
+ download_output = gr.Text(label="Download Link")
147
  submit_button.click(
148
  fn=display_results,
149
  inputs=[video_url, video_file, description],