Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -166,9 +166,14 @@ def is_square_video(video_path):
|
|
166 |
return gr.update(visible=True)
|
167 |
|
168 |
|
169 |
-
def txt_to_driving_video(input_text, video_type):
|
170 |
-
|
171 |
-
|
|
|
|
|
|
|
|
|
|
|
172 |
return video_outpath
|
173 |
|
174 |
|
@@ -208,15 +213,16 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
208 |
gr.Markdown("**Text to talking video generation tool**\n\n")
|
209 |
|
210 |
#gr.Markdown("### 1. Text to audio")
|
211 |
-
gr.Markdown("### 1. Text to Driving-Video")
|
212 |
with gr.Row():
|
213 |
-
|
214 |
-
|
|
|
215 |
# audio_gen_button = gr.Button("Audio generation", variant="primary")
|
216 |
# with gr.Column():
|
217 |
# txt2video_gen_button = gr.Button("txt2video generation", variant="primary")
|
218 |
video_type = gr.Radio(choices=["Female video", "Male video"], label="Select video type", value="Female video")
|
219 |
-
txt2video_gen_button = gr.Button("
|
220 |
|
221 |
#with gr.Column():
|
222 |
#audio_gen_button = gr.Button("Audio generation", variant="primary")
|
@@ -326,7 +332,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
326 |
txt2video_gen_button.click(
|
327 |
fn=txt_to_driving_video,
|
328 |
inputs=[
|
329 |
-
script_txt, video_type
|
330 |
],
|
331 |
outputs=[video_input],
|
332 |
show_progress=True
|
|
|
166 |
return gr.update(visible=True)
|
167 |
|
168 |
|
169 |
+
def txt_to_driving_video(input_text, audio_file, video_type):
|
170 |
+
|
171 |
+
if audio_file is None and input_text is not None:
|
172 |
+
audio_file = gpu_wrapped_elevenlabs_pipeline_generate_voice(text=input_text, voice=None)
|
173 |
+
|
174 |
+
# 오디오파일이 있으면 텍스트보다 오디오를 우선적으로 처리
|
175 |
+
video_outpath = gpu_wrapped_stf_pipeline_execute(audio_file, video_type)
|
176 |
+
|
177 |
return video_outpath
|
178 |
|
179 |
|
|
|
213 |
gr.Markdown("**Text to talking video generation tool**\n\n")
|
214 |
|
215 |
#gr.Markdown("### 1. Text to audio")
|
216 |
+
gr.Markdown("### 1. Text/Audio to Driving-Video")
|
217 |
with gr.Row():
|
218 |
+
with gr.Column(scale=1):
|
219 |
+
script_txt = gr.Text(label="Textbox(Enter text OR upload an audio file.)")
|
220 |
+
audio_file = gr.Audio(label="Upload audio(Enter text OR upload an audio file.)", type="file")
|
221 |
# audio_gen_button = gr.Button("Audio generation", variant="primary")
|
222 |
# with gr.Column():
|
223 |
# txt2video_gen_button = gr.Button("txt2video generation", variant="primary")
|
224 |
video_type = gr.Radio(choices=["Female video", "Male video"], label="Select video type", value="Female video")
|
225 |
+
txt2video_gen_button = gr.Button("Txt/Audio to video generation", variant="primary")
|
226 |
|
227 |
#with gr.Column():
|
228 |
#audio_gen_button = gr.Button("Audio generation", variant="primary")
|
|
|
332 |
txt2video_gen_button.click(
|
333 |
fn=txt_to_driving_video,
|
334 |
inputs=[
|
335 |
+
script_txt, audio_file, video_type
|
336 |
],
|
337 |
outputs=[video_input],
|
338 |
show_progress=True
|