jjz5463 commited on
Commit
1c93d48
·
1 Parent(s): a95e6bf

concatenate videos

Browse files
Files changed (2) hide show
  1. app.py +12 -10
  2. baseline_utils.py +1 -1
app.py CHANGED
@@ -45,9 +45,9 @@ def process_images(diary_image, writer_image):
45
  # Generate the video based on the summaries
46
  video_path = generate_video(scene_list, writer_summary, fps=24)
47
 
48
- captions = scenes_caption(scene_list, openai_api_key)
49
 
50
- return video_path, captions
51
 
52
 
53
  # Define the Gradio interface
@@ -65,20 +65,22 @@ with gr.Blocks() as interface:
65
  gr.Markdown("# Handwritten Diary to Video")
66
 
67
  with gr.Row():
68
- diary_image_input = gr.Image(label="Upload your handwritten diary image", type="pil")
69
- writer_image_input = gr.Image(label="Upload a photo of the writer", type="pil")
 
 
 
70
 
71
- submit_button = gr.Button("Generate Video")
72
-
73
- with gr.Row():
74
- video_output = gr.Video(label="Generated Video")
75
- captions_output = gr.Markdown(label="Scene Captions")
76
 
77
  # Bind the submit button click to trigger the video generation and display
78
  submit_button.click(
79
  fn=gradio_interface,
80
  inputs=[diary_image_input, writer_image_input],
81
- outputs=[video_output, captions_output]
82
  )
83
 
84
  # Launch the interface
 
45
  # Generate the video based on the summaries
46
  video_path = generate_video(scene_list, writer_summary, fps=24)
47
 
48
+ caption = scenes_caption(scene_list, openai_api_key)
49
 
50
+ return video_path, caption
51
 
52
 
53
  # Define the Gradio interface
 
65
  gr.Markdown("# Handwritten Diary to Video")
66
 
67
  with gr.Row():
68
+ # Left column for user inputs
69
+ with gr.Column():
70
+ diary_image_input = gr.Image(label="Upload your handwritten diary image", type="pil")
71
+ writer_image_input = gr.Image(label="Upload a photo of the writer", type="pil")
72
+ submit_button = gr.Button("Generate Video")
73
 
74
+ # Right column for generated video and caption
75
+ with gr.Column():
76
+ video_output = gr.Video(label="Generated Video")
77
+ caption_output = gr.Markdown(label="Scene Caption")
 
78
 
79
  # Bind the submit button click to trigger the video generation and display
80
  submit_button.click(
81
  fn=gradio_interface,
82
  inputs=[diary_image_input, writer_image_input],
83
+ outputs=[video_output, caption_output]
84
  )
85
 
86
  # Launch the interface
baseline_utils.py CHANGED
@@ -126,7 +126,7 @@ def scenes_caption(scenes, api_key):
126
  # Append the generated caption to the list
127
  captions.append(response.choices[0].message.content)
128
 
129
- return captions
130
 
131
 
132
  @spaces.GPU
 
126
  # Append the generated caption to the list
127
  captions.append(response.choices[0].message.content)
128
 
129
+ return "\n\n".join(captions)
130
 
131
 
132
  @spaces.GPU