Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -248,7 +248,7 @@ def process_image_1(image):
|
|
248 |
#cv2.imwrite(f"{rand_im}-vid_tmp_proc.png", image)
|
249 |
#image = f"{rand_im}-vid_tmp_proc.png"
|
250 |
image=Image.fromarray(image)
|
251 |
-
out = esr.realesrgan1(img=image, model_name="realesr-general-x4v3", denoise_strength=0.5, face_enhance=
|
252 |
#out = os.path.abspath(f"{rand_im}-vid_tmp_proc.png")
|
253 |
#out_url = f'https://omnibus-vid-url-dl-mod.hf.space/file={out}'
|
254 |
#out = esr.realesrgan1(image, "realesr-general-x4v3", 0.5, False, 2)
|
@@ -257,7 +257,7 @@ def process_image_1(image):
|
|
257 |
out = np.array(out)
|
258 |
print (out)
|
259 |
return out
|
260 |
-
def improve_quality():
|
261 |
|
262 |
clip1 = VideoFileClip(f"{uid}-clip.mp4")
|
263 |
clip = clip1.fl_image(process_image_1)
|
@@ -292,6 +292,17 @@ with gr.Blocks() as app:
|
|
292 |
hid_box = gr.Textbox(visible=True)
|
293 |
hid_fps = gr.Textbox(visible=True)
|
294 |
with gr.Tab("Quality"):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
295 |
impro_btn = gr.Button("Run")
|
296 |
with gr.Row():
|
297 |
with gr.Column():
|
@@ -345,7 +356,7 @@ with gr.Blocks() as app:
|
|
345 |
|
346 |
|
347 |
|
348 |
-
impro_btn.click(improve_quality,
|
349 |
|
350 |
|
351 |
info_btn.click(dl_json,inp_url,info_json)
|
|
|
248 |
#cv2.imwrite(f"{rand_im}-vid_tmp_proc.png", image)
|
249 |
#image = f"{rand_im}-vid_tmp_proc.png"
|
250 |
image=Image.fromarray(image)
|
251 |
+
out = esr.realesrgan1(img=image, model_name="realesr-general-x4v3", denoise_strength=0.5, face_enhance=True, outscale=1)
|
252 |
#out = os.path.abspath(f"{rand_im}-vid_tmp_proc.png")
|
253 |
#out_url = f'https://omnibus-vid-url-dl-mod.hf.space/file={out}'
|
254 |
#out = esr.realesrgan1(image, "realesr-general-x4v3", 0.5, False, 2)
|
|
|
257 |
out = np.array(out)
|
258 |
print (out)
|
259 |
return out
|
260 |
+
def improve_quality(model_name,denoise_strength,outscale,face_enhance):
|
261 |
|
262 |
clip1 = VideoFileClip(f"{uid}-clip.mp4")
|
263 |
clip = clip1.fl_image(process_image_1)
|
|
|
292 |
hid_box = gr.Textbox(visible=True)
|
293 |
hid_fps = gr.Textbox(visible=True)
|
294 |
with gr.Tab("Quality"):
|
295 |
+
with gr.Row():
|
296 |
+
model_name = gr.Dropdown(label="Real-ESRGAN inference model to be used",
|
297 |
+
choices=["RealESRGAN_x4plus", "RealESRNet_x4plus", "RealESRGAN_x4plus_anime_6B",
|
298 |
+
"RealESRGAN_x2plus", "realesr-general-x4v3"],
|
299 |
+
value="realesr-general-x4v3", show_label=True)
|
300 |
+
denoise_strength = gr.Slider(label="Denoise Strength (Used only with the realesr-general-x4v3 model)",
|
301 |
+
minimum=0, maximum=1, step=0.1, value=0.5)
|
302 |
+
outscale = gr.Slider(label="Image Upscaling Factor",
|
303 |
+
minimum=1, maximum=10, step=1, value=2, show_label=True)
|
304 |
+
face_enhance = gr.Checkbox(label="Face Enhancement using GFPGAN (Doesn't work for anime images)",
|
305 |
+
value=False, show_label=True)
|
306 |
impro_btn = gr.Button("Run")
|
307 |
with gr.Row():
|
308 |
with gr.Column():
|
|
|
356 |
|
357 |
|
358 |
|
359 |
+
impro_btn.click(improve_quality,[model_name,denoise_strength,outscale,face_enhance],clip_out)
|
360 |
|
361 |
|
362 |
info_btn.click(dl_json,inp_url,info_json)
|