Hshsh0877 commited on
Commit
fb9ca87
·
verified ·
1 Parent(s): 7d8407c

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -2,6 +2,8 @@ import gradio as gr
2
  from inference import run_halftime_pipeline
3
 
4
  def process_video(url, product):
 
 
5
  try:
6
  output_video = run_halftime_pipeline(url, product)
7
  return output_video
@@ -12,11 +14,15 @@ ui = gr.Interface(
12
  fn=process_video,
13
  inputs=[
14
  gr.Textbox(label="YouTube URL"),
15
- gr.Textbox(label="Product description")
16
  ],
17
  outputs=gr.Video(label="Edited Video"),
18
- title="YouTube Halftime AI",
19
- description="Insert AI-generated product placements into YouTube videos."
 
 
 
20
  )
21
 
22
- ui.launch()
 
 
2
  from inference import run_halftime_pipeline
3
 
4
  def process_video(url, product):
5
+ if not url or not product:
6
+ return "Please enter a YouTube URL and a product description."
7
  try:
8
  output_video = run_halftime_pipeline(url, product)
9
  return output_video
 
14
  fn=process_video,
15
  inputs=[
16
  gr.Textbox(label="YouTube URL"),
17
+ gr.Textbox(label="Product / Brand description")
18
  ],
19
  outputs=gr.Video(label="Edited Video"),
20
+ title="YouTube Halftime (Simple Version)",
21
+ description=(
22
+ "Prototype: downloads the YouTube video and draws a colored box "
23
+ "where the AI thinks your product should appear, for a few seconds."
24
+ )
25
  )
26
 
27
+ if __name__ == "__main__":
28
+ ui.launch()