sergiomar73 commited on
Commit
787cd7d
1 Parent(s): eb3e38e

Add 500 ms to end, export file in TSV format

Browse files
Files changed (3) hide show
  1. app.py +5 -3
  2. clip.tsv +25 -0
  3. clips.tsv +24 -0
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import datetime
2
  import requests
3
  import gradio as gr
@@ -49,7 +50,8 @@ def calculate_times(input_url, input_text, ms_before, ms_after):
49
  line = lines[i].rstrip()
50
  res.append(f"{line}\t{segments[i][0]}\t{segments[i][1]}\t{input_url}")
51
  df.loc[len(df.index)] = [line, segments[i][0], segments[i][1], input_url]
52
- return input_url, "\n".join(res), df
 
53
 
54
 
55
  app = gr.Interface(
@@ -68,11 +70,12 @@ app = gr.Interface(
68
  minimum=0,
69
  maximum=1000,
70
  step=50,
71
- value=0,
72
  label="Milliseconds AFTER each clip",
73
  ),
74
  ],
75
  outputs=[
 
76
  gr.Video(format="mp4", label="Video file", show_label=True),
77
  gr.Textbox(lines=10, label="Clips", interactive=False, show_copy_button=True),
78
  gr.Dataframe(
@@ -80,7 +83,6 @@ app = gr.Interface(
80
  headers=["text", "start", "stop", "file"],
81
  datatype=["str", "str", "str", "str"],
82
  row_count=0,
83
- # col_count=(4, "fixed"),
84
  ),
85
  ],
86
  # examples=[
 
1
+ import csv
2
  import datetime
3
  import requests
4
  import gradio as gr
 
50
  line = lines[i].rstrip()
51
  res.append(f"{line}\t{segments[i][0]}\t{segments[i][1]}\t{input_url}")
52
  df.loc[len(df.index)] = [line, segments[i][0], segments[i][1], input_url]
53
+ df.to_csv('clips.tsv', sep="\t", encoding='utf-8', index=False, header=False, quoting=csv.QUOTE_NONE)
54
+ return 'clips.tsv', input_url, "\n".join(res), df
55
 
56
 
57
  app = gr.Interface(
 
70
  minimum=0,
71
  maximum=1000,
72
  step=50,
73
+ value=500,
74
  label="Milliseconds AFTER each clip",
75
  ),
76
  ],
77
  outputs=[
78
+ gr.File(label="Clips", show_label=True),
79
  gr.Video(format="mp4", label="Video file", show_label=True),
80
  gr.Textbox(lines=10, label="Clips", interactive=False, show_copy_button=True),
81
  gr.Dataframe(
 
83
  headers=["text", "start", "stop", "file"],
84
  datatype=["str", "str", "str", "str"],
85
  row_count=0,
 
86
  ),
87
  ],
88
  # examples=[
clip.tsv ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ text start stop file
2
+ "Are you ready to jump into a practice? Just say ""Lets Practice""" 00:01.682 00:06.345 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
3
+ "If you'd like to return to the menu, say ""Main Menu""" 00:07.971 00:11.447 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
4
+ Main Menu 00:14.068 00:15.249 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
5
+ Please say or click one of the choices above 00:17.854 00:20.734 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
6
+ Welcome back. 00:35.360 00:36.649 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
7
+ Great to have you back. 00:38.279 00:39.907 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
8
+ It's a pleasure to have you back 00:41.518 00:43.535 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
9
+ Welcome home. 00:45.152 00:46.459 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
10
+ Would you like to hop on another call? Or do you need to hop off? 00:48.062 00:52.462 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
11
+ You can also just return to the main menu. 00:54.091 00:57.062 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
12
+ Do you have time for another practice? 00:58.667 01:01.102 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
13
+ Looks like you didn't make it all the way through the call. 01:02.719 01:05.812 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
14
+ You'll need to start over next time, but it will only take a few minutes. 01:07.434 01:12.056 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
15
+ You can choose to do it again now, or you can return to the main menu. 01:13.679 01:18.176 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
16
+ You hung up on that call in a hurry. 01:19.786 01:22.415 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
17
+ Do you want to try again now or return to the main menu? 01:24.011 01:27.793 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
18
+ Are you ready to view your results? 01:29.402 01:31.850 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
19
+ "Your results are ready. Let's take a look. Say or click ""show my results""" 01:33.471 01:39.547 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
20
+ "The results are in. Say or click ""show my results"" to take a look." 01:41.181 01:46.691 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
21
+ "Ready to see how you did? Say or click ""show my results"" to check it out." 01:48.299 01:54.026 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
22
+ "Your results are now available. Say or click ""show my results""" 01:55.649 02:00.789 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
23
+ Well, I think those were fair questions, and you're likely to face those from other HCP's as well. So it pays off to be ready. Let's see how you did. Click Show my results 02:02.394 02:14.834 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
24
+ Were you ready for those questions? By exercising your response muscles, you'll be even more ready next time questions like these come up. 02:16.455 02:24.626 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
25
+ Do you want an overview of Simulator? Or, tips on how-to practice? 02:26.242 02:31.856 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
clips.tsv ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Are you ready to jump into a practice? Just say "Lets Practice" 00:01.682 00:06.345 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
2
+ If you'd like to return to the menu, say "Main Menu" 00:07.971 00:11.447 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
3
+ Main Menu 00:14.068 00:15.249 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
4
+ Please say or click one of the choices above 00:17.854 00:20.734 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
5
+ Welcome back. 00:35.360 00:36.649 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
6
+ Great to have you back. 00:38.279 00:39.907 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
7
+ It's a pleasure to have you back 00:41.518 00:43.535 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
8
+ Welcome home. 00:45.152 00:46.459 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
9
+ Would you like to hop on another call? Or do you need to hop off? 00:48.062 00:52.462 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
10
+ You can also just return to the main menu. 00:54.091 00:57.062 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
11
+ Do you have time for another practice? 00:58.667 01:01.102 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
12
+ Looks like you didn't make it all the way through the call. 01:02.719 01:05.812 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
13
+ You'll need to start over next time, but it will only take a few minutes. 01:07.434 01:12.056 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
14
+ You can choose to do it again now, or you can return to the main menu. 01:13.679 01:18.176 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
15
+ You hung up on that call in a hurry. 01:19.786 01:22.415 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
16
+ Do you want to try again now or return to the main menu? 01:24.011 01:27.793 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
17
+ Are you ready to view your results? 01:29.402 01:31.850 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
18
+ Your results are ready. Let's take a look. Say or click "show my results" 01:33.471 01:39.547 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
19
+ The results are in. Say or click "show my results" to take a look. 01:41.181 01:46.691 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
20
+ Ready to see how you did? Say or click "show my results" to check it out. 01:48.299 01:54.026 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
21
+ Your results are now available. Say or click "show my results" 01:55.649 02:00.789 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
22
+ Well, I think those were fair questions, and you're likely to face those from other HCP's as well. So it pays off to be ready. Let's see how you did. Click Show my results 02:02.394 02:14.834 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
23
+ Were you ready for those questions? By exercising your response muscles, you'll be even more ready next time questions like these come up. 02:16.455 02:24.626 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4
24
+ Do you want an overview of Simulator? Or, tips on how-to practice? 02:26.242 02:31.856 https://simulation-temporary-test.s3.amazonaws.com/SanofiFluCoach.mp4