Update app.py
Browse files
app.py
CHANGED
@@ -15,11 +15,10 @@ import glob
|
|
15 |
import numpy as np
|
16 |
from basicsr.utils import imwrite
|
17 |
from gfpgan import GFPGANer
|
18 |
-
|
19 |
#os.system("pip freeze")
|
20 |
#os.system("wget https://github.com/TencentARC/GFPGAN/releases/download/v0.2.0/GFPGANCleanv1-NoCE-C2.pth -P .")
|
21 |
import random
|
22 |
-
|
23 |
from PIL import Image
|
24 |
import torch
|
25 |
# torch.hub.download_url_to_file('https://upload.wikimedia.org/wikipedia/commons/thumb/a/ab/Abraham_Lincoln_O-77_matte_collodion_print.jpg/1024px-Abraham_Lincoln_O-77_matte_collodion_print.jpg', 'lincoln.jpg')
|
@@ -88,16 +87,16 @@ for img_path in img_list:
|
|
88 |
|
89 |
|
90 |
|
91 |
-
|
92 |
|
93 |
-
|
|
|
94 |
os.system("ls ./_output")
|
95 |
-
os.system("ls ./_output/
|
96 |
-
input_img = cv2.imread("./_output/
|
97 |
-
|
98 |
|
99 |
#return Image.fromarray(restored_faces[0][:,:,::-1])
|
100 |
-
|
101 |
|
102 |
title = "Melhoria de imagens"
|
103 |
|
@@ -105,18 +104,6 @@ os.system("ls")
|
|
105 |
description = "Sistema para automação。"
|
106 |
|
107 |
article = "<p style='text-align: center'><a href='https://huggingface.co/spaces/akhaliq/GFPGAN/' target='_blank'>clone from akhaliq@huggingface with little change</a> | <a href='https://github.com/TencentARC/GFPGAN' target='_blank'>GFPGAN Github Repo</a></p><center><img src='https://visitor-badge.glitch.me/badge?page_id=akhaliq_GFPGAN' alt='visitor badge'></center>"
|
108 |
-
st.button('OI')
|
109 |
-
|
110 |
-
inference,
|
111 |
-
[gr.inputs.Image(type="filepath", label="Input")],
|
112 |
-
gr.outputs.Image(type="pil", label="Output"),
|
113 |
-
title=title,
|
114 |
-
description=description
|
115 |
-
#,
|
116 |
-
#examples=[
|
117 |
-
|
118 |
-
#['edison.jpg'],
|
119 |
-
#['pessoa3.jpg']
|
120 |
-
#]
|
121 |
-
).launch(enable_queue=True,cache_examples=False,share=True)
|
122 |
|
|
|
15 |
import numpy as np
|
16 |
from basicsr.utils import imwrite
|
17 |
from gfpgan import GFPGANer
|
|
|
18 |
#os.system("pip freeze")
|
19 |
#os.system("wget https://github.com/TencentARC/GFPGAN/releases/download/v0.2.0/GFPGANCleanv1-NoCE-C2.pth -P .")
|
20 |
import random
|
21 |
+
|
22 |
from PIL import Image
|
23 |
import torch
|
24 |
# torch.hub.download_url_to_file('https://upload.wikimedia.org/wikipedia/commons/thumb/a/ab/Abraham_Lincoln_O-77_matte_collodion_print.jpg/1024px-Abraham_Lincoln_O-77_matte_collodion_print.jpg', 'lincoln.jpg')
|
|
|
87 |
|
88 |
|
89 |
|
|
|
90 |
|
91 |
+
|
92 |
+
def inference():
|
93 |
os.system("ls ./_output")
|
94 |
+
os.system("ls ./_output/cmp")
|
95 |
+
input_img = cv2.imread("./_output/cmp/imagem-0001.png" , cv2.IMREAD_COLOR)
|
96 |
+
st.image(input_img)
|
97 |
|
98 |
#return Image.fromarray(restored_faces[0][:,:,::-1])
|
99 |
+
|
100 |
|
101 |
title = "Melhoria de imagens"
|
102 |
|
|
|
104 |
description = "Sistema para automação。"
|
105 |
|
106 |
article = "<p style='text-align: center'><a href='https://huggingface.co/spaces/akhaliq/GFPGAN/' target='_blank'>clone from akhaliq@huggingface with little change</a> | <a href='https://github.com/TencentARC/GFPGAN' target='_blank'>GFPGAN Github Repo</a></p><center><img src='https://visitor-badge.glitch.me/badge?page_id=akhaliq_GFPGAN' alt='visitor badge'></center>"
|
107 |
+
st.button('OI',on_click=inference)
|
108 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
|