FAMILIA commited on
Commit
006270c
·
1 Parent(s): 11305bd
Files changed (1) hide show
  1. app.py +48 -27
app.py CHANGED
@@ -1,37 +1,58 @@
1
  import streamlit as st
 
2
  import os.path
3
-
4
  os.system("mkdir _input")
5
  os.system("mkdir _output")
6
  os.system("mkdir _outputf")
7
  os.system("ls")
8
- if not os.path.isfile("./_input/imagem-0001.png"):
9
- os.system("ffmpeg -i vivi.mp4 -compression_level 10 -pred mixed -pix_fmt rgb24 -sws_flags +accurate_rnd+full_chroma_int -s 1080x1920 -r 0.12 ./_input/imagem-%4d.png")
10
-
11
- os.system("ls ./_input")
12
- if 'myVar' not in globals():
13
- myVar=""
14
- # os.system("pip install git+https://github.com/TencentARC/GFPGAN.git")
15
- os.system("python3 inference_gfpgan.py -i _input -o _output -v 1.3 -s 4")
16
- import cv2
17
-
18
- import random
19
-
20
-
21
- os.system("ls ./_output")
22
- os.system("echo ----")
23
- os.system("ls ./_output/cmp")
24
- os.system("echo ----")
25
- os.system("ls ./_output/restored_imgs")
26
- os.system("echo ----")
27
-
28
-
29
-
30
-
31
  def inference():
32
- random.randint(0, 9)
33
- input_img = cv2.imread("./_output/cmp/imagem-000"+str(random.randint(1, 4))+"_0000.png" , cv2.IMREAD_COLOR)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  input_img= cv2.cvtColor(input_img,cv2.COLOR_BGR2RGB)
 
35
  st.image(input_img)
36
 
37
  #return Image.fromarray(restored_faces[0][:,:,::-1])
@@ -43,6 +64,6 @@ os.system("ls")
43
  description = "Sistema para automação。"
44
 
45
  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>"
46
- st.button('Comparacao',on_click=inference)
47
 
48
 
 
1
  import streamlit as st
2
+ import base64
3
  import os.path
4
+ os.system("sudo apt-get -y install libx264-dev")
5
  os.system("mkdir _input")
6
  os.system("mkdir _output")
7
  os.system("mkdir _outputf")
8
  os.system("ls")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  def inference():
10
+ if not os.path.isfile("./_input/imagem-0001.png"):
11
+ os.system("ffmpeg -i vivi.mp4 -compression_level 10 -pred mixed -pix_fmt rgb24 -sws_flags +accurate_rnd+full_chroma_int -s 1080x1920 -r 30 ./_input/imagem-%4d.png")
12
+
13
+ os.system("ls ./_input")
14
+ if 'myVar' not in globals():
15
+ myVar=""
16
+ # os.system("pip install git+https://github.com/TencentARC/GFPGAN.git")
17
+ os.system("python3 inference_gfpgan.py -i _input -o _output -v 1.3 -s 4")
18
+ import cv2
19
+
20
+ import random
21
+
22
+
23
+ os.system("ls ./_output")
24
+ os.system("echo ----")
25
+ os.system("ls ./_output/cmp")
26
+ os.system("echo ----")
27
+ os.system("ls ./_output/restored_imgs")
28
+ os.system("echo ----")
29
+ #ffmpeg -r 60 -f image2 -s 1920x1080 -i _output/restored_imgs/imagem-%4d.png -pix_fmt yuv420p ./videoSaida/output.mp4
30
+ os.system("ffmpeg -y -r 60 -f image2 -s 1920x1080 -i _output/restored_imgs/imagem-%4d.png -pix_fmt yuv420p ./videoSaida/output.mp4")
31
+ os.system("ls ./videoSaida")
32
+ #st.video("./videoSaida/output.mp4" )
33
+
34
+ with open("./videoSaida/output.mp4", "rb") as file:
35
+
36
+ btn = st.download_button(
37
+
38
+ label="Download video",
39
+
40
+ data=file,
41
+
42
+ file_name="output.png",
43
+
44
+ mime="video/mp4"
45
+
46
+ )
47
+ #st.download_button("download video", data, file_name='output.mp4', mime='video/mp4',)
48
+ #stremio
49
+ #input_img = cv2.imread("./_output/cmp/imagem-0001_0000.png" , cv2.IMREAD_COLOR)
50
+ #input_img = cv2.imread("./_output/cmp/imagem-0001_0000.png" , cv2.IMREAD_COLOR)
51
+
52
+
53
+ input_img = cv2.imread("./_output/restored_imgs/imagem-0002.png" , cv2.IMREAD_COLOR)
54
  input_img= cv2.cvtColor(input_img,cv2.COLOR_BGR2RGB)
55
+
56
  st.image(input_img)
57
 
58
  #return Image.fromarray(restored_faces[0][:,:,::-1])
 
64
  description = "Sistema para automação。"
65
 
66
  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>"
67
+ st.button('Imagem',on_click=inference)
68
 
69