1littlecoder commited on
Commit
37b78fd
1 Parent(s): e966d07

fixed the video frames using the view, also fixed the post repeat missing issue

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -9,6 +9,7 @@ from pixeltable.iterators import FrameIterator
9
  import openai
10
 
11
 
 
12
  # Set up Pixeltable database and table
13
  db_directory = "video_db"
14
  table_name = "video_table"
@@ -165,7 +166,7 @@ def process_and_generate_post(video_file, social_media_type):
165
  )
166
  if sm_gen_flag:
167
  cur_video_df.update({"sm_post": social_media_post})
168
- sm_gen_flag = False
169
 
170
 
171
  print("######## processing thumbnail ##########")
@@ -185,7 +186,7 @@ def process_and_generate_post(video_file, social_media_type):
185
 
186
  frames = frames_view.select(frames_view.frame).collect()
187
 
188
- return cur_video_df["sm_post"], [frame['frame'] for frame in frames]
189
 
190
  except Exception as e:
191
  return f"An error occurred: {e}"
@@ -214,7 +215,8 @@ def gradio_interface():
214
  video_input = gr.Video(label=f"Upload Video File (max {MAX_VIDEO_SIZE_MB} MB):",
215
  include_audio = True,
216
  max_length= 300,
217
- height='400px')
 
218
  social_media_type = gr.Dropdown(
219
  choices=["X (Twitter)", "Facebook", "LinkedIn"],
220
  label="Select Social Media Platform:",
 
9
  import openai
10
 
11
 
12
+
13
  # Set up Pixeltable database and table
14
  db_directory = "video_db"
15
  table_name = "video_table"
 
166
  )
167
  if sm_gen_flag:
168
  cur_video_df.update({"sm_post": social_media_post})
169
+ social_media_post = cur_video_df["sm_post"]
170
 
171
 
172
  print("######## processing thumbnail ##########")
 
186
 
187
  frames = frames_view.select(frames_view.frame).collect()
188
 
189
+ return social_media_post, [frame['frame'] for frame in frames]
190
 
191
  except Exception as e:
192
  return f"An error occurred: {e}"
 
215
  video_input = gr.Video(label=f"Upload Video File (max {MAX_VIDEO_SIZE_MB} MB):",
216
  include_audio = True,
217
  max_length= 300,
218
+ height='400px',
219
+ autoplay= True)
220
  social_media_type = gr.Dropdown(
221
  choices=["X (Twitter)", "Facebook", "LinkedIn"],
222
  label="Select Social Media Platform:",