yerang commited on
Commit
d6d3334
1 Parent(s): e14b577

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +41 -31
app.py CHANGED
@@ -22,8 +22,10 @@ from elevenlabs_utils import ElevenLabsPipeline
22
  from setup_environment import initialize_environment
23
  from src.utils.video import extract_audio
24
  #from flux_dev import create_flux_tab
25
- from flux_schnell import create_flux_tab
26
  # from diffusers import FluxPipeline
 
 
27
 
28
  # import gdown
29
  # folder_url = f"https://drive.google.com/drive/folders/1UtKgzKjFAOmZkhNK-OYT0caJ_w2XAnib"
@@ -35,19 +37,27 @@ from flux_schnell import create_flux_tab
35
 
36
  initialize_environment()
37
 
38
- import sys
39
- sys.path.append('/home/user/.local/lib/python3.10/site-packages')
40
- sys.path.append('/home/user/.local/lib/python3.10/site-packages/stf_alternative/src/stf_alternative')
41
- sys.path.append('/home/user/.local/lib/python3.10/site-packages/stf_tools/src/stf_tools')
42
- sys.path.append('/home/user/app/')
43
- sys.path.append('/home/user/app/stf/')
44
- sys.path.append('/home/user/app/stf/stf_alternative/')
45
- sys.path.append('/home/user/app/stf/stf_alternative/src/stf_alternative')
46
- sys.path.append('/home/user/app/stf/stf_tools')
47
- sys.path.append('/home/user/app/stf/stf_tools/src/stf_tools')
 
 
 
 
 
 
 
 
 
48
 
49
 
50
- import os
51
  # CUDA 경로를 환경 변수로 설정
52
  os.environ['PATH'] = '/usr/local/cuda/bin:' + os.environ.get('PATH', '')
53
  os.environ['LD_LIBRARY_PATH'] = '/usr/local/cuda/lib64:' + os.environ.get('LD_LIBRARY_PATH', '')
@@ -116,7 +126,7 @@ gradio_pipeline = GradioPipeline(
116
 
117
  # 추가 정의
118
  elevenlabs_pipeline = ElevenLabsPipeline()
119
- #stf_pipeline = STFPipeline()
120
 
121
 
122
  @spaces.GPU() #duration=240)
@@ -202,12 +212,12 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
202
 
203
 
204
  gr.Markdown("### 2. Audio to Driving-Video")
205
- # with gr.Row():
206
- # audio_path_component = gr.Textbox(label="Input", value="assets/examples/driving/test_aud.mp3")
207
- # video_gen_button = gr.Button("Audio to Video generation", variant="primary")
208
- # with gr.Row():
209
- # #a2v_output = gr.Video()
210
- # driving_video_path.render()
211
 
212
 
213
  gr.Markdown("### 3. Image to Talking Video")
@@ -310,15 +320,15 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
310
  show_progress=True
311
  )
312
 
313
- # video_gen_button.click(
314
- # fn=gpu_wrapped_stf_pipeline_execute,
315
- # inputs=[
316
- # #output_audio
317
- # audio_path_component
318
- # ],
319
- # outputs=[driving_video_path],
320
- # show_progress=True
321
- # )
322
 
323
 
324
 
@@ -333,9 +343,9 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
333
  outputs=video_input
334
  )
335
 
336
- # 세 번째 탭: Flux 개발용 탭
337
- with gr.Tab("FLUX Image"):
338
- flux_demo = create_flux_tab(image_input) # Flux 개발용 탭 생성
339
 
340
  demo.launch(
341
  server_port=args.server_port,
 
22
  from setup_environment import initialize_environment
23
  from src.utils.video import extract_audio
24
  #from flux_dev import create_flux_tab
25
+ #from flux_schnell import create_flux_tab
26
  # from diffusers import FluxPipeline
27
+ import os
28
+ import sys
29
 
30
  # import gdown
31
  # folder_url = f"https://drive.google.com/drive/folders/1UtKgzKjFAOmZkhNK-OYT0caJ_w2XAnib"
 
37
 
38
  initialize_environment()
39
 
40
+
41
+ sys.path.extend([
42
+ '/home/user/.local/lib/python3.10/site-packages',
43
+ '/home/user/app/',
44
+ '/home/user/app/stf/',
45
+ '/home/user/app/stf/stf_alternative/',
46
+ '/home/user/app/stf/stf_tools'
47
+ ])
48
+
49
+ # sys.path.append('/home/user/.local/lib/python3.10/site-packages')
50
+ # sys.path.append('/home/user/.local/lib/python3.10/site-packages/stf_alternative/src/stf_alternative')
51
+ # sys.path.append('/home/user/.local/lib/python3.10/site-packages/stf_tools/src/stf_tools')
52
+ # sys.path.append('/home/user/app/')
53
+ # sys.path.append('/home/user/app/stf/')
54
+ # sys.path.append('/home/user/app/stf/stf_alternative/')
55
+ # sys.path.append('/home/user/app/stf/stf_alternative/src/stf_alternative')
56
+ # sys.path.append('/home/user/app/stf/stf_tools')
57
+ # sys.path.append('/home/user/app/stf/stf_tools/src/stf_tools')
58
+
59
 
60
 
 
61
  # CUDA 경로를 환경 변수로 설정
62
  os.environ['PATH'] = '/usr/local/cuda/bin:' + os.environ.get('PATH', '')
63
  os.environ['LD_LIBRARY_PATH'] = '/usr/local/cuda/lib64:' + os.environ.get('LD_LIBRARY_PATH', '')
 
126
 
127
  # 추가 정의
128
  elevenlabs_pipeline = ElevenLabsPipeline()
129
+ stf_pipeline = STFPipeline()
130
 
131
 
132
  @spaces.GPU() #duration=240)
 
212
 
213
 
214
  gr.Markdown("### 2. Audio to Driving-Video")
215
+ with gr.Row():
216
+ audio_path_component = gr.Textbox(label="Input", value="assets/examples/driving/test_aud.mp3")
217
+ video_gen_button = gr.Button("Audio to Video generation", variant="primary")
218
+ with gr.Row():
219
+ #a2v_output = gr.Video()
220
+ driving_video_path.render()
221
 
222
 
223
  gr.Markdown("### 3. Image to Talking Video")
 
320
  show_progress=True
321
  )
322
 
323
+ video_gen_button.click(
324
+ fn=gpu_wrapped_stf_pipeline_execute,
325
+ inputs=[
326
+ #output_audio
327
+ audio_path_component
328
+ ],
329
+ outputs=[driving_video_path],
330
+ show_progress=True
331
+ )
332
 
333
 
334
 
 
343
  outputs=video_input
344
  )
345
 
346
+ # # 세 번째 탭: Flux 개발용 탭
347
+ # with gr.Tab("FLUX Image"):
348
+ # flux_demo = create_flux_tab(image_input) # Flux 개발용 탭 생성
349
 
350
  demo.launch(
351
  server_port=args.server_port,