Update app.py
Browse files
app.py
CHANGED
|
@@ -35,8 +35,9 @@ video_examples = [
|
|
| 35 |
|
| 36 |
def generate(input_video):
|
| 37 |
|
| 38 |
-
|
| 39 |
-
|
|
|
|
| 40 |
pretrained_model = "pretrained/recon.safetensors"
|
| 41 |
num_frames = 1
|
| 42 |
test_path = input_video
|
|
@@ -58,7 +59,7 @@ def generate(input_video):
|
|
| 58 |
# Retrieve the file name without the extension
|
| 59 |
#removed_bg_file_name = os.path.splitext(os.path.basename(removed_bg_path))[0]
|
| 60 |
output_videos = glob(os.path.join(f"{workdir}", "*.mp4"))
|
| 61 |
-
return output_videos
|
| 62 |
except subprocess.CalledProcessError as e:
|
| 63 |
return f"Error during inference: {str(e)}"
|
| 64 |
|
|
|
|
| 35 |
|
| 36 |
def generate(input_video):
|
| 37 |
|
| 38 |
+
temp_dir = tempfile.mkdtemp()
|
| 39 |
+
|
| 40 |
+
workdir = temp_dir
|
| 41 |
pretrained_model = "pretrained/recon.safetensors"
|
| 42 |
num_frames = 1
|
| 43 |
test_path = input_video
|
|
|
|
| 59 |
# Retrieve the file name without the extension
|
| 60 |
#removed_bg_file_name = os.path.splitext(os.path.basename(removed_bg_path))[0]
|
| 61 |
output_videos = glob(os.path.join(f"{workdir}", "*.mp4"))
|
| 62 |
+
return output_videos[0]
|
| 63 |
except subprocess.CalledProcessError as e:
|
| 64 |
return f"Error during inference: {str(e)}"
|
| 65 |
|