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()
|