Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -66,7 +66,9 @@ def capture_function(vid=None):
|
|
66 |
|
67 |
def im_2_vid(images,fps):
|
68 |
#width, height = Image.open(images[0]).size
|
69 |
-
|
|
|
|
|
70 |
print (width,height)
|
71 |
size = (width, height)
|
72 |
codec = cv2.VideoWriter_fourcc(*'mp4v') #DIVX, DIVD
|
@@ -180,23 +182,21 @@ def other():
|
|
180 |
|
181 |
with gr.Blocks() as app:
|
182 |
with gr.Tab("Load"):
|
183 |
-
|
184 |
-
inp_url = gr.Textbox()
|
185 |
-
go_btn = gr.Button("Run")
|
186 |
with gr.Row():
|
187 |
with gr.Column():
|
|
|
|
|
188 |
outp_vid=gr.Video()
|
189 |
with gr.Column():
|
190 |
with gr.Row():
|
191 |
frame_count=gr.Textbox(label="Frame Count",interactive = False)
|
192 |
fps=gr.Textbox(label="FPS",interactive = False)
|
193 |
outp_file=gr.Files()
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
out_trim=gr.Video()
|
200 |
|
201 |
with gr.Tab("Frames"):
|
202 |
frame_btn = gr.Button("Get Frames")
|
@@ -223,10 +223,10 @@ with gr.Blocks() as app:
|
|
223 |
def echo_fn(inp):
|
224 |
return inp
|
225 |
#outp_vid.change(echo_fn,outp_vid,[out_trim])
|
226 |
-
trim_btn.click(trim_vid,[outp_vid,start_f,end_f],out_trim)
|
227 |
outp_vid.change(load_video,outp_vid,[frame_count,fps]).then(echo_fn,outp_vid,[out_trim])
|
228 |
frame_btn.click(capture_function,[out_trim],[frame_gal,frame_file])
|
229 |
rem_btn.click(rem_bg,[out_trim],[rem_vid,frame_num])
|
230 |
-
go_btn.click(dl,inp_url,[outp_vid,
|
231 |
app.load(fn=predict, inputs=[text_input,url_params], outputs=[text_output,text_input],_js=load_js)
|
232 |
app.launch()
|
|
|
66 |
|
67 |
def im_2_vid(images,fps):
|
68 |
#width, height = Image.open(images[0]).size
|
69 |
+
this_im=cv2.imread(images[0])
|
70 |
+
print(this_im.shape())
|
71 |
+
width, height = this_im.shape()
|
72 |
print (width,height)
|
73 |
size = (width, height)
|
74 |
codec = cv2.VideoWriter_fourcc(*'mp4v') #DIVX, DIVD
|
|
|
182 |
|
183 |
with gr.Blocks() as app:
|
184 |
with gr.Tab("Load"):
|
|
|
|
|
|
|
185 |
with gr.Row():
|
186 |
with gr.Column():
|
187 |
+
inp_url = gr.Textbox()
|
188 |
+
go_btn = gr.Button("Run")
|
189 |
outp_vid=gr.Video()
|
190 |
with gr.Column():
|
191 |
with gr.Row():
|
192 |
frame_count=gr.Textbox(label="Frame Count",interactive = False)
|
193 |
fps=gr.Textbox(label="FPS",interactive = False)
|
194 |
outp_file=gr.Files()
|
195 |
+
with gr.Row():
|
196 |
+
start_f = gr.Textbox(label = "Start", value = "0:00:00", placeholder = "0:00:23")
|
197 |
+
end_f = gr.Textbox(label = "End", value = "0:00:05", placeholder = "0:00:54")
|
198 |
+
trim_btn=gr.Button("Trim")
|
199 |
+
out_trim=gr.Video()
|
|
|
200 |
|
201 |
with gr.Tab("Frames"):
|
202 |
frame_btn = gr.Button("Get Frames")
|
|
|
223 |
def echo_fn(inp):
|
224 |
return inp
|
225 |
#outp_vid.change(echo_fn,outp_vid,[out_trim])
|
226 |
+
trim_btn.click(trim_vid,[outp_vid,start_f,end_f],[out_trim,in_vid])
|
227 |
outp_vid.change(load_video,outp_vid,[frame_count,fps]).then(echo_fn,outp_vid,[out_trim])
|
228 |
frame_btn.click(capture_function,[out_trim],[frame_gal,frame_file])
|
229 |
rem_btn.click(rem_bg,[out_trim],[rem_vid,frame_num])
|
230 |
+
go_btn.click(dl,inp_url,[outp_vid,outp_file,out_trim])
|
231 |
app.load(fn=predict, inputs=[text_input,url_params], outputs=[text_output,text_input],_js=load_js)
|
232 |
app.launch()
|