Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
import os
|
| 2 |
-
os.system("pip install git+https://huggingface.co/spaces/Omnibus/real_esrgan_mod")
|
| 3 |
import gradio as gr
|
| 4 |
import yt_dlp
|
| 5 |
import json
|
|
@@ -10,12 +10,12 @@ import moviepy
|
|
| 10 |
from moviepy.video.io.ffmpeg_tools import ffmpeg_extract_subclip
|
| 11 |
import moviepy.video.io.ImageSequenceClip
|
| 12 |
from moviepy.editor import *
|
| 13 |
-
import esr
|
| 14 |
uid=uuid.uuid4()
|
| 15 |
if not os.path.exists(f'{uid}'): os.makedirs(f'{uid}')
|
| 16 |
if not os.path.exists(f'{uid}-frames'): os.makedirs(f'{uid}-frames')
|
| 17 |
if not os.path.exists(f'{uid}-rembg'): os.makedirs(f'{uid}-rembg')
|
| 18 |
-
|
| 19 |
|
| 20 |
load_js = """
|
| 21 |
function(text_input, url_params) {
|
|
@@ -242,14 +242,14 @@ def check_load(inp_url,outp_vid,hid_box,start_f,end_f):
|
|
| 242 |
#outp_vid.change(echo_fn,outp_vid,[out_trim])
|
| 243 |
def process_image_1(image):
|
| 244 |
#out = esr(img=image, model_name="realesr-general-x4v3", denoise_strength=0.5, face_enhance=False, outscale=2)
|
| 245 |
-
out = esr.realesrgan1(image, "realesr-general-x4v3", 0.5, False, 2)
|
| 246 |
print (out)
|
| 247 |
out = Image.open(out)
|
| 248 |
return out
|
| 249 |
def improve_quality():
|
| 250 |
clip1 = VideoFileClip(f"{uid}-clip.mp4")
|
| 251 |
clip = clip1.fl_image(process_image_1)
|
| 252 |
-
clip.write_videofile(f"{uid}-clip-high.mp4"
|
| 253 |
return f"{uid}-clip-high.mp4"
|
| 254 |
|
| 255 |
|
|
|
|
| 1 |
import os
|
| 2 |
+
#os.system("pip install git+https://huggingface.co/spaces/Omnibus/real_esrgan_mod")
|
| 3 |
import gradio as gr
|
| 4 |
import yt_dlp
|
| 5 |
import json
|
|
|
|
| 10 |
from moviepy.video.io.ffmpeg_tools import ffmpeg_extract_subclip
|
| 11 |
import moviepy.video.io.ImageSequenceClip
|
| 12 |
from moviepy.editor import *
|
| 13 |
+
#import esr
|
| 14 |
uid=uuid.uuid4()
|
| 15 |
if not os.path.exists(f'{uid}'): os.makedirs(f'{uid}')
|
| 16 |
if not os.path.exists(f'{uid}-frames'): os.makedirs(f'{uid}-frames')
|
| 17 |
if not os.path.exists(f'{uid}-rembg'): os.makedirs(f'{uid}-rembg')
|
| 18 |
+
esr = gr.Interface.load("spaces/Omnibus/Real_ESRGAN_mod")
|
| 19 |
|
| 20 |
load_js = """
|
| 21 |
function(text_input, url_params) {
|
|
|
|
| 242 |
#outp_vid.change(echo_fn,outp_vid,[out_trim])
|
| 243 |
def process_image_1(image):
|
| 244 |
#out = esr(img=image, model_name="realesr-general-x4v3", denoise_strength=0.5, face_enhance=False, outscale=2)
|
| 245 |
+
out = esr.realesrgan1(image, "realesr-general-x4v3", "0.5", "False", "2")
|
| 246 |
print (out)
|
| 247 |
out = Image.open(out)
|
| 248 |
return out
|
| 249 |
def improve_quality():
|
| 250 |
clip1 = VideoFileClip(f"{uid}-clip.mp4")
|
| 251 |
clip = clip1.fl_image(process_image_1)
|
| 252 |
+
clip.write_videofile(f"{uid}-clip-high.mp4")
|
| 253 |
return f"{uid}-clip-high.mp4"
|
| 254 |
|
| 255 |
|