Spaces:
Runtime error
Runtime error
update
Browse files
app.py
CHANGED
|
@@ -1,22 +1,30 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
import os
|
| 3 |
-
import
|
| 4 |
-
import torch
|
| 5 |
-
import imageio
|
| 6 |
import subprocess
|
| 7 |
-
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
# Clone repo nếu chưa có
|
| 11 |
-
if not os.path.exists('
|
| 12 |
subprocess.call(['git', 'clone', 'https://github.com/AliaksandrSiarohin/first-order-model.git'])
|
| 13 |
os.rename('first-order-model', 'first_order_model')
|
| 14 |
|
| 15 |
# Thêm đường dẫn vào PYTHONPATH
|
| 16 |
-
|
| 17 |
sys.path.append('first_order_model')
|
| 18 |
|
| 19 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
from first_order_model.demo import load_checkpoints
|
| 21 |
from first_order_model.animate import normalize_kp
|
| 22 |
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
+
import sys
|
|
|
|
|
|
|
| 3 |
import subprocess
|
| 4 |
+
|
| 5 |
+
# Đảm bảo cài đặt các thư viện cần thiết trước khi import
|
| 6 |
+
subprocess.check_call([sys.executable, "-m", "pip", "install", "scikit-learn"])
|
| 7 |
+
subprocess.check_call([sys.executable, "-m", "pip", "install", "scikit-image==0.19.3"])
|
| 8 |
+
subprocess.check_call([sys.executable, "-m", "pip", "install", "face-alignment==1.3.5"])
|
| 9 |
|
| 10 |
# Clone repo nếu chưa có
|
| 11 |
+
if not os.path.exists('first_order_model'):
|
| 12 |
subprocess.call(['git', 'clone', 'https://github.com/AliaksandrSiarohin/first-order-model.git'])
|
| 13 |
os.rename('first-order-model', 'first_order_model')
|
| 14 |
|
| 15 |
# Thêm đường dẫn vào PYTHONPATH
|
| 16 |
+
sys.path.append('.')
|
| 17 |
sys.path.append('first_order_model')
|
| 18 |
|
| 19 |
+
# Bây giờ import các module cần thiết
|
| 20 |
+
import gradio as gr
|
| 21 |
+
import numpy as np
|
| 22 |
+
import torch
|
| 23 |
+
import imageio
|
| 24 |
+
from skimage.transform import resize
|
| 25 |
+
from skimage import img_as_ubyte
|
| 26 |
+
|
| 27 |
+
# Import các module từ first_order_model
|
| 28 |
from first_order_model.demo import load_checkpoints
|
| 29 |
from first_order_model.animate import normalize_kp
|
| 30 |
|