renatotn7 commited on
Commit
642303e
·
1 Parent(s): 6a57bb2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +49 -48
app.py CHANGED
@@ -16,56 +16,57 @@ if 'exec' not in globals():
16
 
17
  exec=True
18
  if not os.path.isfile("./_input/imagem-0001.png"):
19
- os.system("ffmpeg -i vivi.mp4 -compression_level 10 -pred mixed -pix_fmt rgb24 -sws_flags +accurate_rnd+full_chroma_int -s 1480x2560 -r 0.1 ./_input/imagem-%4d.png")
20
- input_img = cv2.imread("./_input/imagem-0002.png" , cv2.IMREAD_COLOR)
21
- input_img= cv2.cvtColor(input_img,cv2.COLOR_BGR2RGB)
22
-
23
- st.image(input_img)
24
- os.system("ls ./_input")
25
- if 'myVar' not in globals():
26
- myVar=""
27
- # os.system("pip install git+https://github.com/TencentARC/GFPGAN.git")
28
- os.system("python3 inference_gfpgan.py -i _input -o _output -v 1.3 -s 1")
29
-
30
-
31
- os.system("ls ./_output")
32
- os.system("echo ----")
33
- os.system("ls ./_output/cmp")
34
- os.system("echo ----")
35
- os.system("ls ./_output/restored_imgs")
36
- os.system("echo ----")
37
- #ffmpeg -r 60 -f image2 -s 1920x1080 -i _output/restored_imgs/imagem-%4d.png -pix_fmt yuv420p ./videoSaida/output.mp4
38
- os.system("ffmpeg -y -r 30 -f image2 -s 1480x2560 -i _output/restored_imgs/imagem-%4d.png -pix_fmt yuv420p ./videoSaida/output.mp4")
39
- os.system("ls ./videoSaida")
40
- #st.video("./videoSaida/output.mp4" )
41
-
42
- with open("./videoSaida/output.mp4", "rb") as file:
43
-
44
- btn = st.download_button(
45
-
46
- label="Download video",
47
-
48
- data=file,
49
-
50
- file_name="output.png",
51
-
52
- mime="video/mp4"
53
-
54
- )
55
- #st.download_button("download video", data, file_name='output.mp4', mime='video/mp4',)
56
- #stremio
57
- #input_img = cv2.imread("./_output/cmp/imagem-0001_0000.png" , cv2.IMREAD_COLOR)
58
- #input_img = cv2.imread("./_output/cmp/imagem-0001_0000.png" , cv2.IMREAD_COLOR)
59
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
 
61
- input_img = cv2.imread("./_output/restored_imgs/imagem-0002.png" , cv2.IMREAD_COLOR)
62
- input_img= cv2.cvtColor(input_img,cv2.COLOR_BGR2RGB)
63
-
64
- st.image(input_img)
65
- exec=False
66
- #return Image.fromarray(restored_faces[0][:,:,::-1])
67
-
68
-
69
  title = "Melhoria de imagens"
70
 
71
  os.system("ls")
 
16
 
17
  exec=True
18
  if not os.path.isfile("./_input/imagem-0001.png"):
19
+ 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")
20
+ input_img = cv2.imread("./_input/imagem-0002.png" , cv2.IMREAD_COLOR)
21
+ input_img= cv2.cvtColor(input_img,cv2.COLOR_BGR2RGB)
22
+
23
+ st.image(input_img)
24
+ os.system("ls ./_input")
25
+ if 'myVar' not in globals():
26
+ myVar=""
27
+ # os.system("pip install git+https://github.com/TencentARC/GFPGAN.git")
28
+ os.system("python3 inference_gfpgan.py -i _input -o _output -v 1.3 -s 2")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
 
30
+
31
+ os.system("ls ./_output")
32
+ os.system("echo ----")
33
+ os.system("ls ./_output/cmp")
34
+ os.system("echo ----")
35
+ os.system("ls ./_output/restored_imgs")
36
+ os.system("echo ----")
37
+ # s 1480x2560
38
+ #ffmpeg -r 60 -f image2 -s 1920x1080 -i _output/restored_imgs/imagem-%4d.png -pix_fmt yuv420p ./videoSaida/output.mp4
39
+ os.system("ffmpeg -y -r 30 -f image2 -i _output/restored_imgs/imagem-%4d.png -pix_fmt yuv420p ./videoSaida/output.mp4")
40
+ os.system("ls ./videoSaida")
41
+ #st.video("./videoSaida/output.mp4" )
42
+
43
+ with open("./videoSaida/output.mp4", "rb") as file:
44
+
45
+ btn = st.download_button(
46
+
47
+ label="Download video",
48
+
49
+ data=file,
50
+
51
+ file_name="output.png",
52
+
53
+ mime="video/mp4"
54
+
55
+ )
56
+ #st.download_button("download video", data, file_name='output.mp4', mime='video/mp4',)
57
+ #stremio
58
+ #input_img = cv2.imread("./_output/cmp/imagem-0001_0000.png" , cv2.IMREAD_COLOR)
59
+ #input_img = cv2.imread("./_output/cmp/imagem-0001_0000.png" , cv2.IMREAD_COLOR)
60
+
61
+
62
+ input_img = cv2.imread("./_output/restored_imgs/imagem-0002.png" , cv2.IMREAD_COLOR)
63
+ input_img= cv2.cvtColor(input_img,cv2.COLOR_BGR2RGB)
64
+
65
+ st.image(input_img)
66
+ exec=False
67
+ #return Image.fromarray(restored_faces[0][:,:,::-1])
68
 
69
+
 
 
 
 
 
 
 
70
  title = "Melhoria de imagens"
71
 
72
  os.system("ls")