mehal commited on
Commit
e90c0e5
1 Parent(s): fbe1110

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -12
app.py CHANGED
@@ -43,8 +43,6 @@ def predict(youtube_url_or_file_path, labels_text):
43
  video_path = download_youtube_video(youtube_url_or_file_path)
44
  else:
45
  video_path = youtube_url_or_file_path
46
-
47
- # rearrange sampling rate based on video length and model input length
48
  num_total_frames = get_num_total_frames(video_path)
49
  num_model_input_frames = model.config.vision_config.num_frames
50
  if num_total_frames < FRAME_SAMPLING_RATE * num_model_input_frames:
@@ -62,7 +60,6 @@ def predict(youtube_url_or_file_path, labels_text):
62
  inputs = processor(
63
  text=labels, videos=list(frames), return_tensors="pt", padding=True
64
  )
65
- # forward pass
66
  with torch.no_grad():
67
  outputs = model(**inputs)
68
 
@@ -115,15 +112,6 @@ with app:
115
  with gr.Column():
116
  predictions = gr.Label(label="Predictions:", show_label=True)
117
 
118
- # gr.Markdown("**Examples:**")
119
- # gr.Examples(
120
- # examples,
121
- # [youtube_url, youtube_url_labels_text],
122
- # [predictions, video_gif],
123
- # fn=predict,
124
- # cache_examples=True,
125
- # )
126
-
127
  youtube_url_predict_btn.click(
128
  predict,
129
  inputs=[youtube_url, youtube_url_labels_text],
 
43
  video_path = download_youtube_video(youtube_url_or_file_path)
44
  else:
45
  video_path = youtube_url_or_file_path
 
 
46
  num_total_frames = get_num_total_frames(video_path)
47
  num_model_input_frames = model.config.vision_config.num_frames
48
  if num_total_frames < FRAME_SAMPLING_RATE * num_model_input_frames:
 
60
  inputs = processor(
61
  text=labels, videos=list(frames), return_tensors="pt", padding=True
62
  )
 
63
  with torch.no_grad():
64
  outputs = model(**inputs)
65
 
 
112
  with gr.Column():
113
  predictions = gr.Label(label="Predictions:", show_label=True)
114
 
 
 
 
 
 
 
 
 
 
115
  youtube_url_predict_btn.click(
116
  predict,
117
  inputs=[youtube_url, youtube_url_labels_text],