Update app.py
Browse files
app.py
CHANGED
@@ -18,13 +18,23 @@ 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 |
|
21 |
-
|
22 |
-
#-s 720x1280
|
23 |
uploaded_file = st.file_uploader("Choose a file")
|
24 |
if uploaded_file is not None:
|
25 |
# To read file as bytes:
|
26 |
bytes_data = uploaded_file.getvalue()
|
27 |
st.video(bytes_data)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
@st.experimental_memo(suppress_st_warning=True)
|
29 |
def chamada():
|
30 |
percent_complete=0
|
@@ -35,7 +45,14 @@ def chamada():
|
|
35 |
#exec=True
|
36 |
# st.write("ffmpeg separando imagens")
|
37 |
#if not os.path.isfile("./_input/imagem-0001.png"):
|
38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
percent_complete= percent_complete+ 30
|
40 |
with col1:
|
41 |
my_bar.progress(percent_complete )
|
|
|
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 |
|
21 |
+
|
|
|
22 |
uploaded_file = st.file_uploader("Choose a file")
|
23 |
if uploaded_file is not None:
|
24 |
# To read file as bytes:
|
25 |
bytes_data = uploaded_file.getvalue()
|
26 |
st.video(bytes_data)
|
27 |
+
with open("inputvideo", "wb") as binary_file:
|
28 |
+
binary_file.write(some_bytes)
|
29 |
+
vcap = cv2.VideoCapture('inputvideo') # 0=camera
|
30 |
+
width=0
|
31 |
+
height=0
|
32 |
+
if vcap.isOpened():
|
33 |
+
# get vcap property
|
34 |
+
width = vcap.get(cv2.cv.CV_CAP_PROP_FRAME_WIDTH) # float `width`
|
35 |
+
height = vcap.get(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT) # float `height`
|
36 |
+
|
37 |
+
st.write(str(width)+"x"+str(height))
|
38 |
@st.experimental_memo(suppress_st_warning=True)
|
39 |
def chamada():
|
40 |
percent_complete=0
|
|
|
45 |
#exec=True
|
46 |
# st.write("ffmpeg separando imagens")
|
47 |
#if not os.path.isfile("./_input/imagem-0001.png"):
|
48 |
+
vcap = cv2.VideoCapture('inputvideo') # 0=camera
|
49 |
+
width=0
|
50 |
+
height=0
|
51 |
+
if vcap.isOpened():
|
52 |
+
# get vcap property
|
53 |
+
width = vcap.get(cv2.cv.CV_CAP_PROP_FRAME_WIDTH) # float `width`
|
54 |
+
height = vcap.get(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT) # float `height`
|
55 |
+
os.system("ffmpeg -i inputvideo -compression_level 10 -pred mixed -pix_fmt rgb24 -sws_flags +accurate_rnd+full_chroma_int -s "+str(width)+"x"+str(height)+" -r 30 ./_input/imagem-%4d.png")
|
56 |
percent_complete= percent_complete+ 30
|
57 |
with col1:
|
58 |
my_bar.progress(percent_complete )
|