Ii
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import gradio as gr
|
2 |
from refacer import Refacer
|
3 |
import argparse
|
|
|
4 |
import os
|
5 |
import requests
|
6 |
|
@@ -58,9 +59,13 @@ def run(*vars):
|
|
58 |
|
59 |
# Call refacer to process video and get file path
|
60 |
refaced_video_path = refacer.reface(video_path, faces) # refaced video path
|
61 |
-
print(f"Refaced video can be found at {refaced_video_path}")
|
62 |
|
63 |
-
|
|
|
|
|
|
|
|
|
|
|
64 |
|
65 |
# Prepare Gradio components
|
66 |
origin = []
|
|
|
1 |
import gradio as gr
|
2 |
from refacer import Refacer
|
3 |
import argparse
|
4 |
+
import tempfile # Temporary file handling
|
5 |
import os
|
6 |
import requests
|
7 |
|
|
|
59 |
|
60 |
# Call refacer to process video and get file path
|
61 |
refaced_video_path = refacer.reface(video_path, faces) # refaced video path
|
|
|
62 |
|
63 |
+
# Save the output to a temporary file for Gradio UI
|
64 |
+
with tempfile.NamedTemporaryFile(suffix=".mp4", delete=False) as temp_file:
|
65 |
+
temp_file_path = temp_file.name
|
66 |
+
os.rename(refaced_video_path, temp_file_path)
|
67 |
+
|
68 |
+
return temp_file_path # Return the file path to show in Gradio output
|
69 |
|
70 |
# Prepare Gradio components
|
71 |
origin = []
|