Spaces:
Running
Running
refactor: Rename api_choice to model_choice and update model names
Browse files
app.py
CHANGED
|
@@ -86,7 +86,7 @@ def get_files_infos(files):
|
|
| 86 |
return results
|
| 87 |
|
| 88 |
|
| 89 |
-
def get_completion(prompt, files_info, top_p, temperature,
|
| 90 |
# Create table header
|
| 91 |
files_info_string = "| Type | Name | Dimensions | Duration | Audio Channels |\n"
|
| 92 |
files_info_string += "|------|------|------------|-----------|--------|\n"
|
|
@@ -154,10 +154,10 @@ YOUR FFMPEG COMMAND:
|
|
| 154 |
print(msg["content"])
|
| 155 |
print("=====================\n")
|
| 156 |
|
| 157 |
-
if
|
| 158 |
client.base_url = "https://api.deepseek.com/v1"
|
| 159 |
client.api_key = DEEPSEEK_API_KEY
|
| 160 |
-
model = "deepseek-
|
| 161 |
else:
|
| 162 |
client.base_url = "https://api-inference.huggingface.co/v1/"
|
| 163 |
client.api_key = HF_API_KEY
|
|
@@ -192,7 +192,7 @@ YOUR FFMPEG COMMAND:
|
|
| 192 |
raise Exception("API Error")
|
| 193 |
|
| 194 |
|
| 195 |
-
def update(files, prompt, top_p=1, temperature=1,
|
| 196 |
if prompt == "":
|
| 197 |
raise gr.Error("Please enter a prompt.")
|
| 198 |
|
|
@@ -280,10 +280,10 @@ with gr.Blocks() as demo:
|
|
| 280 |
)
|
| 281 |
btn = gr.Button("Run")
|
| 282 |
with gr.Accordion("Parameters", open=False):
|
| 283 |
-
|
| 284 |
-
choices=["
|
| 285 |
-
value="DeepSeek",
|
| 286 |
-
label="
|
| 287 |
)
|
| 288 |
top_p = gr.Slider(
|
| 289 |
minimum=-0,
|
|
@@ -309,7 +309,7 @@ with gr.Blocks() as demo:
|
|
| 309 |
|
| 310 |
btn.click(
|
| 311 |
fn=update,
|
| 312 |
-
inputs=[user_files, user_prompt, top_p, temperature,
|
| 313 |
outputs=[generated_video, generated_command],
|
| 314 |
)
|
| 315 |
with gr.Row():
|
|
@@ -320,7 +320,7 @@ with gr.Blocks() as demo:
|
|
| 320 |
"Use the image as the background with a waveform visualization for the audio positioned in center of the video.",
|
| 321 |
0.7,
|
| 322 |
0.1,
|
| 323 |
-
"
|
| 324 |
],
|
| 325 |
[
|
| 326 |
[
|
|
@@ -337,21 +337,21 @@ with gr.Blocks() as demo:
|
|
| 337 |
"Generate an MP4 slideshow where each photo appears for 2 seconds, using the provided audio as soundtrack.",
|
| 338 |
0.7,
|
| 339 |
0.1,
|
| 340 |
-
"
|
| 341 |
],
|
| 342 |
[
|
| 343 |
["./examples/waterfall-overlay.png", "./examples/waterfall.mp4"],
|
| 344 |
"Add the overlay to the video.",
|
| 345 |
0.7,
|
| 346 |
0.1,
|
| 347 |
-
"
|
| 348 |
],
|
| 349 |
[
|
| 350 |
["./examples/example.mp4"],
|
| 351 |
"Make this video 10 times faster",
|
| 352 |
0.7,
|
| 353 |
0.1,
|
| 354 |
-
"
|
| 355 |
],
|
| 356 |
[
|
| 357 |
[
|
|
@@ -362,7 +362,7 @@ with gr.Blocks() as demo:
|
|
| 362 |
"Create a music video where the waterfall plays in slow motion (0.5x speed) with the heat wave audio track, and the square image appears as a rotating album cover in the bottom right corner",
|
| 363 |
0.7,
|
| 364 |
0.1,
|
| 365 |
-
"DeepSeek",
|
| 366 |
],
|
| 367 |
[
|
| 368 |
[
|
|
@@ -379,7 +379,7 @@ with gr.Blocks() as demo:
|
|
| 379 |
"Create a cat montage where each cat image zooms in and out sequentially for 2 seconds each, synchronized with the audio track, and add a vintage film grain effect",
|
| 380 |
0.7,
|
| 381 |
0.1,
|
| 382 |
-
"DeepSeek",
|
| 383 |
],
|
| 384 |
[
|
| 385 |
[
|
|
@@ -390,7 +390,7 @@ with gr.Blocks() as demo:
|
|
| 390 |
"Create a picture-in-picture effect with the example video in the bottom right corner, the waterfall overlay as a semi-transparent watermark, and the background image filling the rest of the frame",
|
| 391 |
0.7,
|
| 392 |
0.1,
|
| 393 |
-
"DeepSeek",
|
| 394 |
],
|
| 395 |
],
|
| 396 |
inputs=[user_files, user_prompt, top_p, temperature, api_choice],
|
|
|
|
| 86 |
return results
|
| 87 |
|
| 88 |
|
| 89 |
+
def get_completion(prompt, files_info, top_p, temperature, model_choice):
|
| 90 |
# Create table header
|
| 91 |
files_info_string = "| Type | Name | Dimensions | Duration | Audio Channels |\n"
|
| 92 |
files_info_string += "|------|------|------------|-----------|--------|\n"
|
|
|
|
| 154 |
print(msg["content"])
|
| 155 |
print("=====================\n")
|
| 156 |
|
| 157 |
+
if model_choice == "deepseek-ai/DeepSeek-V3-Base":
|
| 158 |
client.base_url = "https://api.deepseek.com/v1"
|
| 159 |
client.api_key = DEEPSEEK_API_KEY
|
| 160 |
+
model = "deepseek-ai/DeepSeek-V3-Base"
|
| 161 |
else:
|
| 162 |
client.base_url = "https://api-inference.huggingface.co/v1/"
|
| 163 |
client.api_key = HF_API_KEY
|
|
|
|
| 192 |
raise Exception("API Error")
|
| 193 |
|
| 194 |
|
| 195 |
+
def update(files, prompt, top_p=1, temperature=1, model_choice="Qwen/Qwen2.5-Coder-32B-Instruct"):
|
| 196 |
if prompt == "":
|
| 197 |
raise gr.Error("Please enter a prompt.")
|
| 198 |
|
|
|
|
| 280 |
)
|
| 281 |
btn = gr.Button("Run")
|
| 282 |
with gr.Accordion("Parameters", open=False):
|
| 283 |
+
model_choice = gr.Radio(
|
| 284 |
+
choices=["Qwen/Qwen2.5-Coder-32B-Instruct", "deepseek-ai/DeepSeek-V3-Base"],
|
| 285 |
+
value="deepseek-ai/DeepSeek-V3-Base",
|
| 286 |
+
label="Model"
|
| 287 |
)
|
| 288 |
top_p = gr.Slider(
|
| 289 |
minimum=-0,
|
|
|
|
| 309 |
|
| 310 |
btn.click(
|
| 311 |
fn=update,
|
| 312 |
+
inputs=[user_files, user_prompt, top_p, temperature, model_choice],
|
| 313 |
outputs=[generated_video, generated_command],
|
| 314 |
)
|
| 315 |
with gr.Row():
|
|
|
|
| 320 |
"Use the image as the background with a waveform visualization for the audio positioned in center of the video.",
|
| 321 |
0.7,
|
| 322 |
0.1,
|
| 323 |
+
"Qwen/Qwen2.5-Coder-32B-Instruct",
|
| 324 |
],
|
| 325 |
[
|
| 326 |
[
|
|
|
|
| 337 |
"Generate an MP4 slideshow where each photo appears for 2 seconds, using the provided audio as soundtrack.",
|
| 338 |
0.7,
|
| 339 |
0.1,
|
| 340 |
+
"Qwen/Qwen2.5-Coder-32B-Instruct",
|
| 341 |
],
|
| 342 |
[
|
| 343 |
["./examples/waterfall-overlay.png", "./examples/waterfall.mp4"],
|
| 344 |
"Add the overlay to the video.",
|
| 345 |
0.7,
|
| 346 |
0.1,
|
| 347 |
+
"Qwen/Qwen2.5-Coder-32B-Instruct",
|
| 348 |
],
|
| 349 |
[
|
| 350 |
["./examples/example.mp4"],
|
| 351 |
"Make this video 10 times faster",
|
| 352 |
0.7,
|
| 353 |
0.1,
|
| 354 |
+
"Qwen/Qwen2.5-Coder-32B-Instruct",
|
| 355 |
],
|
| 356 |
[
|
| 357 |
[
|
|
|
|
| 362 |
"Create a music video where the waterfall plays in slow motion (0.5x speed) with the heat wave audio track, and the square image appears as a rotating album cover in the bottom right corner",
|
| 363 |
0.7,
|
| 364 |
0.1,
|
| 365 |
+
"deepseek-ai/DeepSeek-V3-Base",
|
| 366 |
],
|
| 367 |
[
|
| 368 |
[
|
|
|
|
| 379 |
"Create a cat montage where each cat image zooms in and out sequentially for 2 seconds each, synchronized with the audio track, and add a vintage film grain effect",
|
| 380 |
0.7,
|
| 381 |
0.1,
|
| 382 |
+
"deepseek-ai/DeepSeek-V3-Base",
|
| 383 |
],
|
| 384 |
[
|
| 385 |
[
|
|
|
|
| 390 |
"Create a picture-in-picture effect with the example video in the bottom right corner, the waterfall overlay as a semi-transparent watermark, and the background image filling the rest of the frame",
|
| 391 |
0.7,
|
| 392 |
0.1,
|
| 393 |
+
"deepseek-ai/DeepSeek-V3-Base",
|
| 394 |
],
|
| 395 |
],
|
| 396 |
inputs=[user_files, user_prompt, top_p, temperature, api_choice],
|