File size: 2,572 Bytes
a20719a
006270c
21a2ce4
006270c
92ed922
 
 
 
942386d
006270c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b4aaf0d
006270c
942386d
927b3fb
160b451
942386d
160b451
8c5fb4a
160b451
bb1d671
8c5fb4a
160b451
 
006270c
942386d
1306203
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import streamlit as st
import base64
import os.path
os.system("sudo apt-get -y install libx264-dev")
os.system("mkdir _input")
os.system("mkdir _output")
os.system("mkdir _outputf")
os.system("ls")
def inference():
    if not os.path.isfile("./_input/imagem-0001.png"):
        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")
    
    os.system("ls ./_input") 
    if 'myVar' not in globals():
        myVar=""
       # os.system("pip install git+https://github.com/TencentARC/GFPGAN.git")
    os.system("python3 inference_gfpgan.py -i _input -o _output -v 1.3 -s 4")
    import cv2
    
    import random
    
    
    os.system("ls ./_output")
    os.system("echo ----")
    os.system("ls ./_output/cmp")
    os.system("echo ----")
    os.system("ls ./_output/restored_imgs")
    os.system("echo ----")
    #ffmpeg -r 60 -f image2 -s 1920x1080 -i _output/restored_imgs/imagem-%4d.png   -pix_fmt yuv420p ./videoSaida/output.mp4
    os.system("ffmpeg -y -r 60 -f image2 -s 1920x1080 -i _output/restored_imgs/imagem-%4d.png   -pix_fmt yuv420p ./videoSaida/output.mp4")
    os.system("ls ./videoSaida")
    #st.video("./videoSaida/output.mp4" )
    
    with open("./videoSaida/output.mp4", "rb") as file:
    
        btn = st.download_button(
    
                label="Download video",
    
                data=file,
    
                file_name="output.png",
    
                mime="video/mp4"
    
              )
    #st.download_button("download video", data, file_name='output.mp4', mime='video/mp4',)
    #stremio
    #input_img = cv2.imread("./_output/cmp/imagem-0001_0000.png" , cv2.IMREAD_COLOR)
    #input_img = cv2.imread("./_output/cmp/imagem-0001_0000.png" , cv2.IMREAD_COLOR)

    
    input_img = cv2.imread("./_output/restored_imgs/imagem-0002.png" , cv2.IMREAD_COLOR)
    input_img= cv2.cvtColor(input_img,cv2.COLOR_BGR2RGB) 
    
    st.image(input_img)
   
    #return Image.fromarray(restored_faces[0][:,:,::-1])
    

title = "Melhoria de imagens"

os.system("ls")
description = "Sistema para automação。"

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>"
st.button('Imagem',on_click=inference)