Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -56,8 +56,6 @@ def download_liveportrait():
|
|
| 56 |
print("Failed to initialize LivePortrait:", e)
|
| 57 |
raise
|
| 58 |
|
| 59 |
-
download_liveportrait()
|
| 60 |
-
|
| 61 |
|
| 62 |
def download_huggingface_resources():
|
| 63 |
"""
|
|
@@ -85,8 +83,6 @@ def download_huggingface_resources():
|
|
| 85 |
print("General error in downloading resources:", e)
|
| 86 |
raise
|
| 87 |
|
| 88 |
-
download_huggingface_resources()
|
| 89 |
-
|
| 90 |
|
| 91 |
def get_project_root():
|
| 92 |
"""Get the root directory of the current project."""
|
|
@@ -577,19 +573,19 @@ def compress_video(input_path, output_path, target_size_mb):
|
|
| 577 |
|
| 578 |
def process_video(video_file):
|
| 579 |
|
| 580 |
-
#
|
| 581 |
-
|
| 582 |
-
|
| 583 |
-
|
| 584 |
-
|
| 585 |
-
|
| 586 |
|
| 587 |
-
|
| 588 |
-
|
| 589 |
-
|
| 590 |
-
|
| 591 |
-
|
| 592 |
-
|
| 593 |
|
| 594 |
compressed_path = "./uploaded_video_compressed.mp4"
|
| 595 |
compress_video(video_file, compressed_path, target_size_mb=1)
|
|
@@ -609,7 +605,6 @@ def process_video(video_file):
|
|
| 609 |
print(f"Output video is ready: {output_video_path}")
|
| 610 |
return gr.update(value=output_video_path, visible=True) # Show video
|
| 611 |
|
| 612 |
-
subprocess.check_call([sys.executable, "-m", "pip", "install", "gradio==5.8.0"])
|
| 613 |
|
| 614 |
# Custom CSS styling for the interface
|
| 615 |
css = """
|
|
|
|
| 56 |
print("Failed to initialize LivePortrait:", e)
|
| 57 |
raise
|
| 58 |
|
|
|
|
|
|
|
| 59 |
|
| 60 |
def download_huggingface_resources():
|
| 61 |
"""
|
|
|
|
| 83 |
print("General error in downloading resources:", e)
|
| 84 |
raise
|
| 85 |
|
|
|
|
|
|
|
| 86 |
|
| 87 |
def get_project_root():
|
| 88 |
"""Get the root directory of the current project."""
|
|
|
|
| 573 |
|
| 574 |
def process_video(video_file):
|
| 575 |
|
| 576 |
+
# εε§ε LivePortrait
|
| 577 |
+
try:
|
| 578 |
+
download_liveportrait()
|
| 579 |
+
except Exception as e:
|
| 580 |
+
print("Failed to initialize LivePortrait:", e)
|
| 581 |
+
return gr.update(value=None, visible=False)
|
| 582 |
|
| 583 |
+
# δΈθ½½ Hugging Face θ΅ζΊ
|
| 584 |
+
try:
|
| 585 |
+
download_huggingface_resources()
|
| 586 |
+
except Exception as e:
|
| 587 |
+
print("Failed to download Hugging Face resources:", e)
|
| 588 |
+
return gr.update(value=None, visible=False)
|
| 589 |
|
| 590 |
compressed_path = "./uploaded_video_compressed.mp4"
|
| 591 |
compress_video(video_file, compressed_path, target_size_mb=1)
|
|
|
|
| 605 |
print(f"Output video is ready: {output_video_path}")
|
| 606 |
return gr.update(value=output_video_path, visible=True) # Show video
|
| 607 |
|
|
|
|
| 608 |
|
| 609 |
# Custom CSS styling for the interface
|
| 610 |
css = """
|