Upload folder using huggingface_hub
Browse files
app.py
CHANGED
@@ -2,12 +2,21 @@ import gradio as gr
|
|
2 |
import os
|
3 |
import numpy as np
|
4 |
|
5 |
-
|
|
|
|
|
|
|
6 |
output = "./cached_examples/"
|
7 |
output += "peft" if lora else "audiocraft"
|
8 |
output += "_" + dataset + "_" + size + "_" + video_file[-7:-4]
|
9 |
-
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
if not os.path.exists(output):
|
13 |
print(output)
|
@@ -18,8 +27,8 @@ def no_cpu_warning(video_file, dataset, lora, size):
|
|
18 |
return output
|
19 |
|
20 |
with gr.Blocks() as demo:
|
21 |
-
gr.Markdown('<span style="color:yellow"> **WARNING**: Multiple
|
22 |
-
gr.Interface(fn=
|
23 |
inputs=[
|
24 |
gr.Video(value="./videos/n_5.mp4",
|
25 |
label="Original Video",
|
|
|
2 |
import os
|
3 |
import numpy as np
|
4 |
|
5 |
+
global current_video_index
|
6 |
+
current_video_index = "v"
|
7 |
+
|
8 |
+
def load_cached_video(video_file, dataset, lora, size):
|
9 |
output = "./cached_examples/"
|
10 |
output += "peft" if lora else "audiocraft"
|
11 |
output += "_" + dataset + "_" + size + "_" + video_file[-7:-4]
|
12 |
+
output += "_" + globals()["current_video_index"] + ".mp4"
|
13 |
+
# roll trough the video indexes
|
14 |
+
if globals()["current_video_index"] == "v":
|
15 |
+
globals()["current_video_index"] = "v1"
|
16 |
+
elif globals()["current_video_index"] == "v1":
|
17 |
+
globals()["current_video_index"] = "v2"
|
18 |
+
else:
|
19 |
+
globals()["current_video_index"] = "v"
|
20 |
|
21 |
if not os.path.exists(output):
|
22 |
print(output)
|
|
|
27 |
return output
|
28 |
|
29 |
with gr.Blocks() as demo:
|
30 |
+
gr.Markdown('<span style="color:yellow"> **WARNING**: Multiple video examples have to be downloaded first to use this UI properly. Please be patient, as the videos meight take a moment to download.</span>')
|
31 |
+
gr.Interface(fn=load_cached_video,
|
32 |
inputs=[
|
33 |
gr.Video(value="./videos/n_5.mp4",
|
34 |
label="Original Video",
|