Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -3,20 +3,17 @@ import subprocess
|
|
3 |
import os
|
4 |
from datetime import datetime
|
5 |
|
6 |
-
#
|
7 |
-
import os
|
8 |
-
|
9 |
def merge_model_parts():
|
10 |
parts = [
|
11 |
-
"facevid2vid_00189-model_aa",
|
12 |
-
"facevid2vid_00189-model_bb",
|
13 |
-
"facevid2vid_00189-model_cc",
|
14 |
-
"facevid2vid_00189-model_dd",
|
15 |
-
"facevid2vid_00189-model_ee"
|
16 |
]
|
17 |
output_file = "checkpoints/facevid2vid_00189-model.pth.tar"
|
18 |
-
|
19 |
-
# Sadece yoksa birleştir
|
20 |
if not os.path.exists(output_file):
|
21 |
with open(output_file, "wb") as out:
|
22 |
for part in parts:
|
@@ -26,7 +23,10 @@ def merge_model_parts():
|
|
26 |
else:
|
27 |
print("🟡 Birleştirilmiş dosya zaten var.")
|
28 |
|
|
|
|
|
29 |
|
|
|
30 |
def generate_video(source_image, driven_audio):
|
31 |
output_dir = "results"
|
32 |
os.makedirs(output_dir, exist_ok=True)
|
@@ -39,6 +39,7 @@ def generate_video(source_image, driven_audio):
|
|
39 |
|
40 |
return result_path
|
41 |
|
|
|
42 |
demo = gr.Interface(
|
43 |
fn=generate_video,
|
44 |
inputs=[
|
@@ -48,4 +49,5 @@ demo = gr.Interface(
|
|
48 |
outputs=gr.Video(label="Generated Video")
|
49 |
)
|
50 |
|
|
|
51 |
demo.launch()
|
|
|
3 |
import os
|
4 |
from datetime import datetime
|
5 |
|
6 |
+
# 🔧 Model parçalarını birleştirme fonksiyonu
|
|
|
|
|
7 |
def merge_model_parts():
|
8 |
parts = [
|
9 |
+
"checkpoints/facevid2vid_00189-model_aa",
|
10 |
+
"checkpoints/facevid2vid_00189-model_bb",
|
11 |
+
"checkpoints/facevid2vid_00189-model_cc",
|
12 |
+
"checkpoints/facevid2vid_00189-model_dd",
|
13 |
+
"checkpoints/facevid2vid_00189-model_ee"
|
14 |
]
|
15 |
output_file = "checkpoints/facevid2vid_00189-model.pth.tar"
|
16 |
+
|
|
|
17 |
if not os.path.exists(output_file):
|
18 |
with open(output_file, "wb") as out:
|
19 |
for part in parts:
|
|
|
23 |
else:
|
24 |
print("🟡 Birleştirilmiş dosya zaten var.")
|
25 |
|
26 |
+
# 🔥 Birleştirme işlemini başta yap
|
27 |
+
merge_model_parts()
|
28 |
|
29 |
+
# 🔁 Ana video üretim fonksiyonu
|
30 |
def generate_video(source_image, driven_audio):
|
31 |
output_dir = "results"
|
32 |
os.makedirs(output_dir, exist_ok=True)
|
|
|
39 |
|
40 |
return result_path
|
41 |
|
42 |
+
# 🎛️ Gradio arayüzü
|
43 |
demo = gr.Interface(
|
44 |
fn=generate_video,
|
45 |
inputs=[
|
|
|
49 |
outputs=gr.Video(label="Generated Video")
|
50 |
)
|
51 |
|
52 |
+
# 🚀 Başlat
|
53 |
demo.launch()
|