Update app.py
Browse files
app.py
CHANGED
@@ -9,7 +9,7 @@ os.system("mkdir _input")
|
|
9 |
os.system("mkdir _output")
|
10 |
os.system("mkdir _outputf")
|
11 |
os.system("ls")
|
12 |
-
|
13 |
|
14 |
title = "Melhoria de imagens"
|
15 |
st.title(title)
|
@@ -18,34 +18,37 @@ description = "Sistema para automação。"
|
|
18 |
st.header(description)
|
19 |
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>"
|
20 |
#-s 720x1280
|
21 |
-
@st.experimental_memo
|
22 |
def chamada():
|
23 |
percent_complete=0
|
24 |
my_bar = st.progress(0)
|
25 |
percent_complete= percent_complete+ 10
|
26 |
-
|
|
|
27 |
#exec=True
|
28 |
-
|
29 |
#if not os.path.isfile("./_input/imagem-0001.png"):
|
30 |
os.system("ffmpeg -i vivi.mp4 -compression_level 10 -pred mixed -pix_fmt rgb24 -sws_flags +accurate_rnd+full_chroma_int -s 1480x2560 -r 30 ./_input/imagem-%4d.png")
|
31 |
percent_complete= percent_complete+ 30
|
32 |
-
|
33 |
-
|
|
|
34 |
input_img = cv2.imread("./_input/imagem-0002.png" , cv2.IMREAD_COLOR)
|
35 |
input_img= cv2.cvtColor(input_img,cv2.COLOR_BGR2RGB)
|
36 |
-
|
37 |
-
|
38 |
|
39 |
os.system("ls ./_input")
|
40 |
if 'myVar' not in globals():
|
41 |
myVar=""
|
42 |
st.write("melhorando faces")
|
43 |
-
with
|
|
|
44 |
# os.system("pip install git+https://github.com/TencentARC/GFPGAN.git")
|
45 |
os.system("python3 inference_gfpgan.py -i _input -o _output -v 1.3 -s 2")
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
|
50 |
os.system("ls ./_output")
|
51 |
os.system("echo ----")
|
@@ -54,14 +57,17 @@ def chamada():
|
|
54 |
os.system("ls ./_output/restored_imgs")
|
55 |
os.system("echo ----")
|
56 |
# s 1480x2560
|
57 |
-
|
|
|
58 |
#ffmpeg -r 60 -f image2 -s 1920x1080 -i _output/restored_imgs/imagem-%4d.png -pix_fmt yuv420p ./videoSaida/output.mp4
|
59 |
os.system("ffmpeg -y -r 30 -f image2 -i _output/restored_imgs/imagem-%4d.png -pix_fmt yuv420p ./videoSaida/output.mp4")
|
60 |
os.system("ls ./videoSaida")
|
61 |
#st.video("./videoSaida/output.mp4" )
|
62 |
-
|
63 |
-
|
64 |
-
|
|
|
|
|
65 |
with open("./videoSaida/output.mp4", "rb") as file:
|
66 |
st.video(file)
|
67 |
|
@@ -80,12 +86,12 @@ def chamada():
|
|
80 |
#stremio
|
81 |
#input_img = cv2.imread("./_output/cmp/imagem-0001_0000.png" , cv2.IMREAD_COLOR)
|
82 |
#input_img = cv2.imread("./_output/cmp/imagem-0001_0000.png" , cv2.IMREAD_COLOR)
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
|
88 |
-
|
89 |
exec=False
|
90 |
#return Image.fromarray(restored_faces[0][:,:,::-1])
|
91 |
load = st.checkbox("load")
|
|
|
9 |
os.system("mkdir _output")
|
10 |
os.system("mkdir _outputf")
|
11 |
os.system("ls")
|
12 |
+
col1, col2 = st.columns(2)
|
13 |
|
14 |
title = "Melhoria de imagens"
|
15 |
st.title(title)
|
|
|
18 |
st.header(description)
|
19 |
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>"
|
20 |
#-s 720x1280
|
21 |
+
@st.experimental_memo
|
22 |
def chamada():
|
23 |
percent_complete=0
|
24 |
my_bar = st.progress(0)
|
25 |
percent_complete= percent_complete+ 10
|
26 |
+
with col1:
|
27 |
+
my_bar.progress(percent_complete )
|
28 |
#exec=True
|
29 |
+
st.write("ffmpeg separando imagens")
|
30 |
#if not os.path.isfile("./_input/imagem-0001.png"):
|
31 |
os.system("ffmpeg -i vivi.mp4 -compression_level 10 -pred mixed -pix_fmt rgb24 -sws_flags +accurate_rnd+full_chroma_int -s 1480x2560 -r 30 ./_input/imagem-%4d.png")
|
32 |
percent_complete= percent_complete+ 30
|
33 |
+
with col1:
|
34 |
+
my_bar.progress(percent_complete )
|
35 |
+
st.write("testando imagem")
|
36 |
input_img = cv2.imread("./_input/imagem-0002.png" , cv2.IMREAD_COLOR)
|
37 |
input_img= cv2.cvtColor(input_img,cv2.COLOR_BGR2RGB)
|
38 |
+
with col1:
|
39 |
+
st.image(input_img)
|
40 |
|
41 |
os.system("ls ./_input")
|
42 |
if 'myVar' not in globals():
|
43 |
myVar=""
|
44 |
st.write("melhorando faces")
|
45 |
+
with col2:
|
46 |
+
with st.spinner('Wait for it...'):
|
47 |
# os.system("pip install git+https://github.com/TencentARC/GFPGAN.git")
|
48 |
os.system("python3 inference_gfpgan.py -i _input -o _output -v 1.3 -s 2")
|
49 |
+
with col1:
|
50 |
+
percent_complete= percent_complete+ 30
|
51 |
+
my_bar.progress(percent_complete )
|
52 |
|
53 |
os.system("ls ./_output")
|
54 |
os.system("echo ----")
|
|
|
57 |
os.system("ls ./_output/restored_imgs")
|
58 |
os.system("echo ----")
|
59 |
# s 1480x2560
|
60 |
+
with col1:
|
61 |
+
st.write("recompilando video")
|
62 |
#ffmpeg -r 60 -f image2 -s 1920x1080 -i _output/restored_imgs/imagem-%4d.png -pix_fmt yuv420p ./videoSaida/output.mp4
|
63 |
os.system("ffmpeg -y -r 30 -f image2 -i _output/restored_imgs/imagem-%4d.png -pix_fmt yuv420p ./videoSaida/output.mp4")
|
64 |
os.system("ls ./videoSaida")
|
65 |
#st.video("./videoSaida/output.mp4" )
|
66 |
+
with col1:
|
67 |
+
st.write("preparando para download do video")
|
68 |
+
percent_complete= percent_complete+ 30
|
69 |
+
my_bar.progress(percent_complete )
|
70 |
+
with col2:
|
71 |
with open("./videoSaida/output.mp4", "rb") as file:
|
72 |
st.video(file)
|
73 |
|
|
|
86 |
#stremio
|
87 |
#input_img = cv2.imread("./_output/cmp/imagem-0001_0000.png" , cv2.IMREAD_COLOR)
|
88 |
#input_img = cv2.imread("./_output/cmp/imagem-0001_0000.png" , cv2.IMREAD_COLOR)
|
89 |
+
with col2
|
90 |
+
st.write("demonstrando imagem restaurada")
|
91 |
+
input_img = cv2.imread("./_output/restored_imgs/imagem-0002.png" , cv2.IMREAD_COLOR)
|
92 |
+
input_img= cv2.cvtColor(input_img,cv2.COLOR_BGR2RGB)
|
93 |
|
94 |
+
st.image(input_img)
|
95 |
exec=False
|
96 |
#return Image.fromarray(restored_faces[0][:,:,::-1])
|
97 |
load = st.checkbox("load")
|