Update app.py
Browse files
app.py
CHANGED
@@ -183,6 +183,9 @@ def interface():
|
|
183 |
bgm_files = gr.Dropdown(choices=get_bgm_file_list(), label="Chọn nhạc nền")
|
184 |
video_output = gr.Video(label="Video tạo ra")
|
185 |
|
|
|
|
|
|
|
186 |
def create_video_func(script, audio_file, keywords, max_clip_duration, join_order, bgm_file):
|
187 |
""" Tạo video từ các thông tin đầu vào. """
|
188 |
try:
|
@@ -217,6 +220,11 @@ def interface():
|
|
217 |
except Exception as e:
|
218 |
print(f"Lỗi khi tạo video: {e}")
|
219 |
return None
|
|
|
|
|
|
|
|
|
|
|
220 |
|
221 |
return app
|
222 |
|
|
|
183 |
bgm_files = gr.Dropdown(choices=get_bgm_file_list(), label="Chọn nhạc nền")
|
184 |
video_output = gr.Video(label="Video tạo ra")
|
185 |
|
186 |
+
# Thêm nút để tạo video
|
187 |
+
video_button = gr.Button("Tạo Video")
|
188 |
+
|
189 |
def create_video_func(script, audio_file, keywords, max_clip_duration, join_order, bgm_file):
|
190 |
""" Tạo video từ các thông tin đầu vào. """
|
191 |
try:
|
|
|
220 |
except Exception as e:
|
221 |
print(f"Lỗi khi tạo video: {e}")
|
222 |
return None
|
223 |
+
|
224 |
+
# Liên kết nút với hàm xử lý video
|
225 |
+
video_button.click(create_video_func,
|
226 |
+
inputs=[script_input, audio_file, keywords_output, max_clip_duration, join_order, bgm_files],
|
227 |
+
outputs=video_output)
|
228 |
|
229 |
return app
|
230 |
|