Update app.py
Browse files
app.py
CHANGED
|
@@ -562,7 +562,7 @@ def process_video_bg(vid, bg_type="์์", bg_image=None, bg_video=None, color=
|
|
| 562 |
print(f"Error: {e}")
|
| 563 |
elapsed_time = time.time() - start_time
|
| 564 |
yield gr.update(visible=False), gr.update(visible=True), f"๋น๋์ค ์ฒ๋ฆฌ ์ค๋ฅ: {e}. ๊ฒฝ๊ณผ ์๊ฐ: {elapsed_time:.2f}์ด"
|
| 565 |
-
yield None,
|
| 566 |
|
| 567 |
@spaces.GPU
|
| 568 |
def merge_videos_with_audio(video_files, audio_file, audio_volume, output_fps):
|
|
@@ -570,7 +570,7 @@ def merge_videos_with_audio(video_files, audio_file, audio_volume, output_fps):
|
|
| 570 |
if not video_files:
|
| 571 |
return None, "๋น๋์ค ํ์ผ์ ์
๋ก๋ํด์ฃผ์ธ์."
|
| 572 |
|
| 573 |
-
if len(video_files) > 10:
|
| 574 |
return None, "์ต๋ 10๊ฐ์ ๋น๋์ค๋ง ์
๋ก๋ ๊ฐ๋ฅํฉ๋๋ค."
|
| 575 |
|
| 576 |
try:
|
|
@@ -677,6 +677,18 @@ def merge_videos_with_audio(video_files, audio_file, audio_volume, output_fps):
|
|
| 677 |
logging.error(f"Video merge error: {str(e)}")
|
| 678 |
return None, f"โ ์ค๋ฅ ๋ฐ์: {str(e)}"
|
| 679 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 680 |
# CSS
|
| 681 |
css = """
|
| 682 |
:root {
|
|
@@ -1143,4 +1155,5 @@ try:
|
|
| 1143 |
except:
|
| 1144 |
pass
|
| 1145 |
|
| 1146 |
-
|
|
|
|
|
|
| 562 |
print(f"Error: {e}")
|
| 563 |
elapsed_time = time.time() - start_time
|
| 564 |
yield gr.update(visible=False), gr.update(visible=True), f"๋น๋์ค ์ฒ๋ฆฌ ์ค๋ฅ: {e}. ๊ฒฝ๊ณผ ์๊ฐ: {elapsed_time:.2f}์ด"
|
| 565 |
+
yield None, None, f"๋น๋์ค ์ฒ๋ฆฌ ์ค๋ฅ: {e}. ๊ฒฝ๊ณผ ์๊ฐ: {elapsed_time:.2f}์ด"
|
| 566 |
|
| 567 |
@spaces.GPU
|
| 568 |
def merge_videos_with_audio(video_files, audio_file, audio_volume, output_fps):
|
|
|
|
| 570 |
if not video_files:
|
| 571 |
return None, "๋น๋์ค ํ์ผ์ ์
๋ก๋ํด์ฃผ์ธ์."
|
| 572 |
|
| 573 |
+
if isinstance(video_files, list) and len(video_files) > 10:
|
| 574 |
return None, "์ต๋ 10๊ฐ์ ๋น๋์ค๋ง ์
๋ก๋ ๊ฐ๋ฅํฉ๋๋ค."
|
| 575 |
|
| 576 |
try:
|
|
|
|
| 677 |
logging.error(f"Video merge error: {str(e)}")
|
| 678 |
return None, f"โ ์ค๋ฅ ๋ฐ์: {str(e)}"
|
| 679 |
|
| 680 |
+
# GPU ์ด๊ธฐํ ํจ์ ์ถ๊ฐ
|
| 681 |
+
def dummy_gpu_init():
|
| 682 |
+
"""GPU ์ด๊ธฐํ๋ฅผ ์ํ ๋๋ฏธ ํจ์"""
|
| 683 |
+
if torch.cuda.is_available():
|
| 684 |
+
try:
|
| 685 |
+
# ๊ฐ๋จํ ํ
์ ์ฐ์ฐ์ผ๋ก GPU ์ด๊ธฐํ
|
| 686 |
+
dummy_tensor = torch.zeros(1).to(device)
|
| 687 |
+
del dummy_tensor
|
| 688 |
+
logging.info("GPU initialized successfully")
|
| 689 |
+
except Exception as e:
|
| 690 |
+
logging.warning(f"GPU initialization warning: {e}")
|
| 691 |
+
|
| 692 |
# CSS
|
| 693 |
css = """
|
| 694 |
:root {
|
|
|
|
| 1155 |
except:
|
| 1156 |
pass
|
| 1157 |
|
| 1158 |
+
if __name__ == "__main__":
|
| 1159 |
+
demo.launch()
|