Update app.py
Browse files
app.py
CHANGED
@@ -754,10 +754,10 @@ with gr.Blocks(css=css, js=js, head=head) as demo:
|
|
754 |
avg[0] = avg[0] / len(locations)
|
755 |
avg[1] = avg[1] / len(locations)
|
756 |
|
757 |
-
vtt = ""
|
758 |
h = [0,0]
|
759 |
m = [0,0]
|
760 |
-
s = [0
|
761 |
|
762 |
for k, location in enumerate(locations):
|
763 |
lat = vincenty((location["lat"], 0), (avg[0], 0)) * 1000
|
@@ -766,13 +766,13 @@ with gr.Blocks(css=css, js=js, head=head) as demo:
|
|
766 |
locations[k]["lng"] = float(lng / 2.5 * 111 * np.sign(location["lng"]-avg[1]))
|
767 |
|
768 |
for l, sec in enumerate(s):
|
|
|
769 |
if s[l] == 60:
|
770 |
s[l] = 0
|
771 |
m[l] = m[l] + 1
|
772 |
if m[l] == 60:
|
773 |
m[l] = 0
|
774 |
h[l] = h[l] + 1
|
775 |
-
s[l] = s[l] + 1
|
776 |
|
777 |
vtt = vtt + str(k+1) + "\n" + str(h[0]).zfill(2) + ":" + str(m[0]).zfill(2) + ":" + str(s[0]).zfill(2) + ".000 --> " + str(h[1]).zfill(2) + ":" + str(m[1]).zfill(2) + ":" + str(s[1]).zfill(2) + ".000\n" + str(locations[k]["lat"]) + "," + str(locations[k]["lng"]) + " " + str(locations[k]["heading"]) + "," + str(locations[k]["pitch"]) + "\n\n"
|
778 |
|
@@ -783,7 +783,7 @@ with gr.Blocks(css=css, js=js, head=head) as demo:
|
|
783 |
# Process the video and get the path of the output video
|
784 |
output_video_path = make_video(uploaded_video,encoder=model_type,blur_data=blurin,o=boffset,b=bsize)
|
785 |
|
786 |
-
return output_video_path + (
|
787 |
|
788 |
submit.click(on_submit, inputs=[input_video, model_type, blur_in, boffset, bsize, coords], outputs=[processed_video, processed_zip, output_frame, output_mask, output_depth, coords])
|
789 |
|
|
|
754 |
avg[0] = avg[0] / len(locations)
|
755 |
avg[1] = avg[1] / len(locations)
|
756 |
|
757 |
+
vtt = "WEBVTT\n\n"
|
758 |
h = [0,0]
|
759 |
m = [0,0]
|
760 |
+
s = [-1,0]
|
761 |
|
762 |
for k, location in enumerate(locations):
|
763 |
lat = vincenty((location["lat"], 0), (avg[0], 0)) * 1000
|
|
|
766 |
locations[k]["lng"] = float(lng / 2.5 * 111 * np.sign(location["lng"]-avg[1]))
|
767 |
|
768 |
for l, sec in enumerate(s):
|
769 |
+
s[l] = s[l] + 1
|
770 |
if s[l] == 60:
|
771 |
s[l] = 0
|
772 |
m[l] = m[l] + 1
|
773 |
if m[l] == 60:
|
774 |
m[l] = 0
|
775 |
h[l] = h[l] + 1
|
|
|
776 |
|
777 |
vtt = vtt + str(k+1) + "\n" + str(h[0]).zfill(2) + ":" + str(m[0]).zfill(2) + ":" + str(s[0]).zfill(2) + ".000 --> " + str(h[1]).zfill(2) + ":" + str(m[1]).zfill(2) + ":" + str(s[1]).zfill(2) + ".000\n" + str(locations[k]["lat"]) + "," + str(locations[k]["lng"]) + " " + str(locations[k]["heading"]) + "," + str(locations[k]["pitch"]) + "\n\n"
|
778 |
|
|
|
783 |
# Process the video and get the path of the output video
|
784 |
output_video_path = make_video(uploaded_video,encoder=model_type,blur_data=blurin,o=boffset,b=bsize)
|
785 |
|
786 |
+
return output_video_path + (vtt[1:-2],) #(json.dumps(locations),)
|
787 |
|
788 |
submit.click(on_submit, inputs=[input_video, model_type, blur_in, boffset, bsize, coords], outputs=[processed_video, processed_zip, output_frame, output_mask, output_depth, coords])
|
789 |
|