Update app.py
Browse files
    	
        app.py
    CHANGED
    
    | @@ -127,17 +127,10 @@ def interface(): | |
| 127 | 
             
                            docx_path = "script.docx"
         | 
| 128 | 
             
                            create_docx(content, docx_path)
         | 
| 129 |  | 
| 130 | 
            -
                            audio_path = await async_text_to_speech(content, "vi-VN-HoaiMyNeural", "Tiếng Việt")
         | 
| 131 | 
            -
                            return docx_path, audio_path, "Nội dung đã được xác nhận và âm thanh đã được tạo!"
         | 
| 132 | 
            -
             | 
| 133 | 
             
                        content_button.click(generate_content,
         | 
| 134 | 
             
                                             inputs=[prompt, file_upload, content_type],
         | 
| 135 | 
             
                                             outputs=[content_output, download_docx, status_message])
         | 
| 136 |  | 
| 137 | 
            -
                        confirm_button.click(confirm_content,
         | 
| 138 | 
            -
                                             inputs=[content_output],
         | 
| 139 | 
            -
                                             outputs=[download_docx, download_audio, status_message])
         | 
| 140 | 
            -
                    
         | 
| 141 | 
             
                    # Định nghĩa danh sách giọng đọc
         | 
| 142 | 
             
                    VOICES = ["vi-VN-HoaiMyNeural"]
         | 
| 143 |  | 
| @@ -150,7 +143,7 @@ def interface(): | |
| 150 |  | 
| 151 | 
             
                        async def text_to_speech_func(text, voice):
         | 
| 152 | 
             
                            try:
         | 
| 153 | 
            -
                                audio_path = await async_text_to_speech(text, voice | 
| 154 | 
             
                                return audio_path, audio_path
         | 
| 155 | 
             
                            except Exception as e:
         | 
| 156 | 
             
                                print(f"Lỗi khi chuyển đổi văn bản thành giọng nói: {e}")
         | 
| @@ -158,7 +151,7 @@ def interface(): | |
| 158 |  | 
| 159 | 
             
                        audio_button.click(text_to_speech_func,
         | 
| 160 | 
             
                                           inputs=[text_input, voice_select],
         | 
| 161 | 
            -
                                           outputs=[audio_output | 
| 162 |  | 
| 163 | 
             
                    with gr.Tab("Tạo Video"):
         | 
| 164 | 
             
                        script_input = gr.Textbox(label="Nhập kịch bản")
         | 
|  | |
| 127 | 
             
                            docx_path = "script.docx"
         | 
| 128 | 
             
                            create_docx(content, docx_path)
         | 
| 129 |  | 
|  | |
|  | |
|  | |
| 130 | 
             
                        content_button.click(generate_content,
         | 
| 131 | 
             
                                             inputs=[prompt, file_upload, content_type],
         | 
| 132 | 
             
                                             outputs=[content_output, download_docx, status_message])
         | 
| 133 |  | 
|  | |
|  | |
|  | |
|  | |
| 134 | 
             
                    # Định nghĩa danh sách giọng đọc
         | 
| 135 | 
             
                    VOICES = ["vi-VN-HoaiMyNeural"]
         | 
| 136 |  | 
|  | |
| 143 |  | 
| 144 | 
             
                        async def text_to_speech_func(text, voice):
         | 
| 145 | 
             
                            try:
         | 
| 146 | 
            +
                                audio_path = await async_text_to_speech(text, voice)
         | 
| 147 | 
             
                                return audio_path, audio_path
         | 
| 148 | 
             
                            except Exception as e:
         | 
| 149 | 
             
                                print(f"Lỗi khi chuyển đổi văn bản thành giọng nói: {e}")
         | 
|  | |
| 151 |  | 
| 152 | 
             
                        audio_button.click(text_to_speech_func,
         | 
| 153 | 
             
                                           inputs=[text_input, voice_select],
         | 
| 154 | 
            +
                                           outputs=[audio_output])
         | 
| 155 |  | 
| 156 | 
             
                    with gr.Tab("Tạo Video"):
         | 
| 157 | 
             
                        script_input = gr.Textbox(label="Nhập kịch bản")
         | 
