sergiomar73 commited on
Commit
ffcb7ca
·
verified ·
1 Parent(s): 45500ce

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +58 -58
app.py CHANGED
@@ -74,62 +74,62 @@ css = """
74
  """
75
 
76
 
77
- with gr.Blocks(title="Start and stop times", css=css) as app:
78
- gr.Markdown(
79
- """# Start and stop times generator
80
- Please, fill the Video URL and Clip texts textboxes and click the Run button"""
81
- )
82
- with gr.Row():
83
- with gr.Column(scale=3):
84
- text1 = gr.Textbox(
85
- lines=1,
86
- placeholder="Video URL...",
87
- label="Video URL",
88
- elem_classes=["required"],
89
- )
90
- text2 = gr.Textbox(
91
- lines=5,
92
- max_lines=10,
93
- placeholder="List of clip texts...",
94
- label="Clip texts",
95
- elem_classes=["required"],
96
- )
97
- slider1 = gr.Slider(
98
- minimum=0,
99
- maximum=1000,
100
- step=50,
101
- value=0,
102
- label="Milliseconds BEFORE each clip",
103
- )
104
- slider2 = gr.Slider(
105
- minimum=0,
106
- maximum=1000,
107
- step=50,
108
- value=500,
109
- label="Milliseconds AFTER each clip",
110
- )
111
- btn_submit = gr.Button(value="Run", variant="primary", size="sm")
112
- video = gr.Video(
113
- format="mp4", label="Video file", show_label=True, interactive=False
114
- )
115
- with gr.Column(scale=5):
116
- file = gr.File(
117
- label="Clips", show_label=True, interactive=False, file_count="single"
118
- )
119
- lines = gr.Textbox(
120
- lines=10, label="Clips", interactive=False, show_copy_button=True
121
- )
122
- data = gr.Dataframe(
123
- label="Clips",
124
- headers=["text", "start", "stop", "file"],
125
- datatype=["str", "str", "str", "str"],
126
- row_count=0,
127
- )
128
- btn_submit.click(
129
- calculate_times,
130
- inputs=[text1, text2, slider1, slider2],
131
- outputs=[lines, file, data],
132
- )
133
- text1.blur(load_video, inputs=[text1], outputs=[video])
134
 
135
- app.launch()
 
74
  """
75
 
76
 
77
+ # Define the Gradio interface
78
+ iface = gr.Interface(
79
+ fn=calculate_times,
80
+ inputs=[
81
+ gr.Markdown(
82
+ """# Start and stop times generator
83
+ Please, fill the Video URL and Clip texts textboxes and click the Run button"""
84
+ ),
85
+ gr.Textbox(
86
+ lines=1,
87
+ placeholder="Video URL...",
88
+ label="Video URL",
89
+ elem_classes=["required"],
90
+ ),
91
+ gr.Textbox(
92
+ lines=5,
93
+ max_lines=10,
94
+ placeholder="List of clip texts...",
95
+ label="Clip texts",
96
+ elem_classes=["required"],
97
+ ),
98
+ gr.Slider(
99
+ minimum=0,
100
+ maximum=1000,
101
+ step=50,
102
+ value=0,
103
+ label="Milliseconds BEFORE each clip",
104
+ ),
105
+ gr.Slider(
106
+ minimum=0,
107
+ maximum=1000,
108
+ step=50,
109
+ value=500,
110
+ label="Milliseconds AFTER each clip",
111
+ ),
112
+ gr.Button(value="Run", variant="primary", size="sm"),
113
+ gr.Video(
114
+ format="mp4", label="Video file", show_label=True, interactive=False
115
+ )
116
+ ],
117
+ outputs=[
118
+ gr.File(
119
+ label="Clips", show_label=True, interactive=False, file_count="single"
120
+ ),
121
+ gr.Textbox(
122
+ lines=10, label="Clips", interactive=False, show_copy_button=True
123
+ ),
124
+ gr.Dataframe(
125
+ label="Clips",
126
+ headers=["text", "start", "stop", "file"],
127
+ datatype=["str", "str", "str", "str"],
128
+ row_count=0,
129
+ )
130
+ ],
131
+ description="# Start and stop times",
132
+ css=css
133
+ )
134
 
135
+ iface.launch()