Spaces:
Build error
Build error
jrguo
commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,6 +4,28 @@ from FakeVD.code_test import predict
|
|
| 4 |
import os
|
| 5 |
os.environ['GRADIO_TEMP_DIR'] = "../cache/"
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
model = get_model()
|
| 8 |
FakeVD_model = predict.get_model()
|
| 9 |
|
|
|
|
| 4 |
import os
|
| 5 |
os.environ['GRADIO_TEMP_DIR'] = "../cache/"
|
| 6 |
|
| 7 |
+
|
| 8 |
+
def prepare_env():
|
| 9 |
+
import subprocess
|
| 10 |
+
# 定义要运行的命令
|
| 11 |
+
command = [
|
| 12 |
+
'pip', 'install', 'modelscope[audio]', '-f',
|
| 13 |
+
'https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html'
|
| 14 |
+
]
|
| 15 |
+
# 运行命令
|
| 16 |
+
try:
|
| 17 |
+
# 使用subprocess.run来执行命令
|
| 18 |
+
result = subprocess.run(command, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
| 19 |
+
# 打印命令的输出
|
| 20 |
+
print("STDOUT:", result.stdout.decode())
|
| 21 |
+
print("STDERR:", result.stderr.decode())
|
| 22 |
+
except subprocess.CalledProcessError as e:
|
| 23 |
+
# 捕获并打印命令执行过程中的错误
|
| 24 |
+
print("An error occurred while executing the command:", e)
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
prepare_env()
|
| 28 |
+
|
| 29 |
model = get_model()
|
| 30 |
FakeVD_model = predict.get_model()
|
| 31 |
|