Spaces:
Runtime error
Runtime error
Commit
·
1fe1ea5
1
Parent(s):
d5681b3
Update app.py
Browse files
app.py
CHANGED
|
@@ -25,7 +25,19 @@ sum_llm_chain = tag_chain.chain(llm=local_llm)
|
|
| 25 |
pexels_api_key = os.getenv('pexels_api_key')
|
| 26 |
|
| 27 |
def pred(product_name, orientation):
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
gc.collect()
|
| 30 |
utils.combine_videos(folder_name)
|
| 31 |
return ["\n".join(sentences), os.path.join(folder_name, "Final_Ad_Video.mp4")]
|
|
@@ -35,9 +47,10 @@ def pred(product_name, orientation):
|
|
| 35 |
|
| 36 |
with gr.Blocks() as demo:
|
| 37 |
dimension = gr.Dropdown(
|
| 38 |
-
["
|
|
|
|
| 39 |
)
|
| 40 |
-
product_name = gr.Textbox(label="
|
| 41 |
captions = gr.Textbox(label="captions")
|
| 42 |
video = gr.Video()
|
| 43 |
btn = gr.Button("Submit")
|
|
|
|
| 25 |
pexels_api_key = os.getenv('pexels_api_key')
|
| 26 |
|
| 27 |
def pred(product_name, orientation):
|
| 28 |
+
if orientation == "Shorts/Reels/TikTok (1080 x 1920)":
|
| 29 |
+
orientation = "potrait"
|
| 30 |
+
height = 1080
|
| 31 |
+
width = 1920
|
| 32 |
+
elif orientation == "Youtube Videos (1920 x 1080)":
|
| 33 |
+
orientation = "landscape"
|
| 34 |
+
height = 1920
|
| 35 |
+
width = 1080
|
| 36 |
+
else :
|
| 37 |
+
orientation = "square"
|
| 38 |
+
height = 1080
|
| 39 |
+
width = 1080
|
| 40 |
+
folder_name, sentences = pexels.generate_videos(product_name, pexels_api_key, orientation, height, width, llm_chain, sum_llm_chain)
|
| 41 |
gc.collect()
|
| 42 |
utils.combine_videos(folder_name)
|
| 43 |
return ["\n".join(sentences), os.path.join(folder_name, "Final_Ad_Video.mp4")]
|
|
|
|
| 47 |
|
| 48 |
with gr.Blocks() as demo:
|
| 49 |
dimension = gr.Dropdown(
|
| 50 |
+
["Shorts/Reels/TikTok (1080 x 1920)", "Facebook/Youtube Videos (1920 x 1080)", "Square (1080 x 1080)"],
|
| 51 |
+
label="Video Dimension", info="Choose dimension"
|
| 52 |
)
|
| 53 |
+
product_name = gr.Textbox(label="product name")
|
| 54 |
captions = gr.Textbox(label="captions")
|
| 55 |
video = gr.Video()
|
| 56 |
btn = gr.Button("Submit")
|