Spaces:
Runtime error
Runtime error
Update inference_video.py
Browse files- inference_video.py +10 -2
inference_video.py
CHANGED
|
@@ -3,13 +3,23 @@ import numpy as np
|
|
| 3 |
import glob
|
| 4 |
from os.path import isfile, join
|
| 5 |
import subprocess
|
|
|
|
| 6 |
import os
|
|
|
|
| 7 |
import shutil
|
| 8 |
from io import BytesIO
|
| 9 |
import io
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
IMAGE_FORMATS = ('.png', '.jpg', '.jpeg', '.tiff', '.bmp', '.gif')
|
| 12 |
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
def inference_image(image, size):
|
| 15 |
global model2
|
|
@@ -159,8 +169,6 @@ for filename in os.listdir(directory):
|
|
| 159 |
|
| 160 |
pathOut = "results_videos/"+filenameVid
|
| 161 |
|
| 162 |
-
fps = 25.0 #change this to FPS of your source video
|
| 163 |
-
|
| 164 |
convert_frames_to_video(pathIn, pathOut, fps)
|
| 165 |
|
| 166 |
|
|
|
|
| 3 |
import glob
|
| 4 |
from os.path import isfile, join
|
| 5 |
import subprocess
|
| 6 |
+
from IPython.display import clear_output
|
| 7 |
import os
|
| 8 |
+
from google.colab import files
|
| 9 |
import shutil
|
| 10 |
from io import BytesIO
|
| 11 |
import io
|
| 12 |
+
from RealESRGAN import RealESRGAN
|
| 13 |
+
import torch
|
| 14 |
+
from PIL import Image
|
| 15 |
+
import numpy as np
|
| 16 |
+
|
| 17 |
|
| 18 |
IMAGE_FORMATS = ('.png', '.jpg', '.jpeg', '.tiff', '.bmp', '.gif')
|
| 19 |
|
| 20 |
+
cap = cv2.VideoCapture(video)
|
| 21 |
+
fps = cap.get(cv2.CAP_PROP_FPS)
|
| 22 |
+
|
| 23 |
|
| 24 |
def inference_image(image, size):
|
| 25 |
global model2
|
|
|
|
| 169 |
|
| 170 |
pathOut = "results_videos/"+filenameVid
|
| 171 |
|
|
|
|
|
|
|
| 172 |
convert_frames_to_video(pathIn, pathOut, fps)
|
| 173 |
|
| 174 |
|