Update app.py
Browse files
app.py
CHANGED
@@ -84,6 +84,14 @@ def process_docx(file_path):
|
|
84 |
text += para.text
|
85 |
return text
|
86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
# Giao diện Gradio
|
88 |
def interface():
|
89 |
with gr.Blocks() as app:
|
@@ -171,8 +179,7 @@ def interface():
|
|
171 |
keywords_output = gr.Textbox(label="Từ khóa", interactive=True)
|
172 |
max_clip_duration = gr.Slider(minimum=2, maximum=5, step=1, label="Thời lượng tối đa mỗi video (giây)")
|
173 |
join_order = gr.Checkbox(label="Ghép ngẫu nhiên", value=True) # Mặc định là ghép ngẫu nhiên
|
174 |
-
bgm_files = gr.Dropdown(choices=get_bgm_file_list(), label="Chọn nhạc nền")
|
175 |
-
create_video_button = gr.Button("Tạo Video")
|
176 |
video_output = gr.Video(label="Video tạo ra")
|
177 |
|
178 |
def create_video_func(script, audio_file, keywords, max_clip_duration, join_order, bgm_file):
|
|
|
84 |
text += para.text
|
85 |
return text
|
86 |
|
87 |
+
def get_bgm_file_list():
|
88 |
+
"""
|
89 |
+
Trả về danh sách các tệp nhạc nền.
|
90 |
+
"""
|
91 |
+
# Giả sử bạn có một thư mục chứa các tệp nhạc nền
|
92 |
+
song_dir = "/data/bg-music"
|
93 |
+
return [os.path.basename(file) for file in glob.glob(os.path.join(song_dir, "*.mp3"))]
|
94 |
+
|
95 |
# Giao diện Gradio
|
96 |
def interface():
|
97 |
with gr.Blocks() as app:
|
|
|
179 |
keywords_output = gr.Textbox(label="Từ khóa", interactive=True)
|
180 |
max_clip_duration = gr.Slider(minimum=2, maximum=5, step=1, label="Thời lượng tối đa mỗi video (giây)")
|
181 |
join_order = gr.Checkbox(label="Ghép ngẫu nhiên", value=True) # Mặc định là ghép ngẫu nhiên
|
182 |
+
bgm_files = gr.Dropdown(choices=get_bgm_file_list(), label="Chọn nhạc nền")
|
|
|
183 |
video_output = gr.Video(label="Video tạo ra")
|
184 |
|
185 |
def create_video_func(script, audio_file, keywords, max_clip_duration, join_order, bgm_file):
|