Ii
commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,7 +3,6 @@ from refacer import Refacer
|
|
| 3 |
import argparse
|
| 4 |
import os
|
| 5 |
import requests
|
| 6 |
-
import tempfile
|
| 7 |
|
| 8 |
# Hugging Face URL to download the model
|
| 9 |
model_url = "https://huggingface.co/ofter/4x-UltraSharp/resolve/main/inswapper_128.onnx"
|
|
@@ -56,16 +55,9 @@ def run(video_path, *vars):
|
|
| 56 |
'threshold': thresholds[k]
|
| 57 |
})
|
| 58 |
|
| 59 |
-
# Call refacer to process video
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
refaced_video_path = refacer.reface(video_path, faces, output_path=temp_video_path)
|
| 63 |
-
print(f"Processing completed. Video available temporarily.")
|
| 64 |
-
|
| 65 |
-
# Load video content as bytes and return to Gradio
|
| 66 |
-
with open(refaced_video_path, "rb") as video_file:
|
| 67 |
-
video_data = video_file.read()
|
| 68 |
-
return video_data
|
| 69 |
|
| 70 |
# Prepare Gradio components
|
| 71 |
origin = []
|
|
|
|
| 3 |
import argparse
|
| 4 |
import os
|
| 5 |
import requests
|
|
|
|
| 6 |
|
| 7 |
# Hugging Face URL to download the model
|
| 8 |
model_url = "https://huggingface.co/ofter/4x-UltraSharp/resolve/main/inswapper_128.onnx"
|
|
|
|
| 55 |
'threshold': thresholds[k]
|
| 56 |
})
|
| 57 |
|
| 58 |
+
# Call refacer to process video
|
| 59 |
+
refaced_video = refacer.reface(video_path, faces) # Directly returns the processed video as bytes
|
| 60 |
+
return refaced_video # Return video content to display in Gradio UI
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
# Prepare Gradio components
|
| 63 |
origin = []
|