Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,41 +17,57 @@ download_files_from_url()
|
|
| 17 |
initialize_environment()
|
| 18 |
|
| 19 |
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
os.environ['PATH'] = '/usr/local/cuda/bin:' + os.environ.get('PATH', '')
|
| 37 |
-
os.environ['LD_LIBRARY_PATH'] = '/usr/local/cuda/lib64:' + os.environ.get('LD_LIBRARY_PATH', '')
|
| 38 |
-
# 확인용 출력
|
| 39 |
-
print("PATH:", os.environ['PATH'])
|
| 40 |
-
print("LD_LIBRARY_PATH:", os.environ['LD_LIBRARY_PATH'])
|
| 41 |
-
|
| 42 |
|
|
|
|
| 43 |
|
|
|
|
| 44 |
|
| 45 |
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
|
| 48 |
-
|
| 49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
|
| 51 |
-
|
| 52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
|
| 54 |
-
return f"Hello {zero + n} Tensor"
|
| 55 |
|
| 56 |
-
demo = gr.Interface(fn=greet, inputs=gr.Number(), outputs=gr.Text())
|
| 57 |
demo.launch()
|
|
|
|
| 17 |
initialize_environment()
|
| 18 |
|
| 19 |
|
| 20 |
+
sys.path.append('/home/user/.local/lib/python3.10/site-packages')
|
| 21 |
+
sys.path.append('/home/user/.local/lib/python3.10/site-packages/stf_alternative/src/stf_alternative')
|
| 22 |
+
sys.path.append('/home/user/.local/lib/python3.10/site-packages/stf_tools/src/stf_tools')
|
| 23 |
+
sys.path.append('/tmp/')
|
| 24 |
+
sys.path.append('/tmp/stf/')
|
| 25 |
+
sys.path.append('/tmp/stf/stf_alternative/')
|
| 26 |
+
sys.path.append('/tmp/stf/stf_alternative/src/stf_alternative')
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
# CUDA 경로를 환경 변수로 설정
|
| 31 |
+
os.environ['PATH'] = '/usr/local/cuda/bin:' + os.environ.get('PATH', '')
|
| 32 |
+
os.environ['LD_LIBRARY_PATH'] = '/usr/local/cuda/lib64:' + os.environ.get('LD_LIBRARY_PATH', '')
|
| 33 |
+
# 확인용 출력
|
| 34 |
+
print("PATH:", os.environ['PATH'])
|
| 35 |
+
print("LD_LIBRARY_PATH:", os.environ['LD_LIBRARY_PATH'])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
+
from stf_utils import STFPipeline
|
| 38 |
|
| 39 |
+
stf_pipeline = STFPipeline()
|
| 40 |
|
| 41 |
|
| 42 |
+
@spaces.GPU(duration=120)
|
| 43 |
+
def gpu_wrapped_stf_pipeline_execute(audio_path):
|
| 44 |
+
return stf_pipeline.execute(audio_path)
|
| 45 |
|
| 46 |
|
| 47 |
+
driving_video_path=gr.Video()
|
| 48 |
|
| 49 |
+
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
| 50 |
+
audio_path_component = gr.Textbox(label="Input", value="assets/examples/driving/test_aud.mp3")
|
| 51 |
+
stf_button = gr.Button("stf test", variant="primary")
|
| 52 |
+
driving_video_path.render()
|
| 53 |
|
| 54 |
+
stf_button.click(
|
| 55 |
+
fn=gpu_wrapped_stf_pipeline_execute,
|
| 56 |
+
inputs=[
|
| 57 |
+
audio_path_component
|
| 58 |
+
],
|
| 59 |
+
outputs=[driving_video_path]
|
| 60 |
+
)
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
# @spaces.GPU
|
| 66 |
+
# def greet(n):
|
| 67 |
+
# print(zero.device) # <-- 'cuda:0' 🤗
|
| 68 |
+
# return f"Hello {zero + n} Tensor"
|
| 69 |
+
|
| 70 |
|
|
|
|
| 71 |
|
| 72 |
+
#demo = gr.Interface(fn=greet, inputs=gr.Number(), outputs=gr.Text())
|
| 73 |
demo.launch()
|