IThinkIAmCool commited on
Commit
96dad7a
1 Parent(s): d7725ec

added native support for v query parameter.

Browse files

and a small change which is simpler

`
- if len(submit_segments) == 0:
+ if not submit_segments:
`

Files changed (1) hide show
  1. app.py +12 -2
app.py CHANGED
@@ -205,7 +205,17 @@ def main():
205
  ts_type_id = st.selectbox(
206
  'Transcript type', TRANSCRIPT_TYPES.keys(), index=0, format_func=lambda x: TRANSCRIPT_TYPES[x]['label'], on_change=output.empty)
207
 
208
- video_input = top.text_input('Video URL/ID:', on_change=output.empty)
 
 
 
 
 
 
 
 
 
 
209
  categories = top.multiselect('Categories:',
210
  CATGEGORY_OPTIONS.keys(),
211
  CATGEGORY_OPTIONS.keys(),
@@ -284,7 +294,7 @@ def main():
284
  st.write(f"**Confidence:** {confidence:.2f}%")
285
  st.write(f'**Text:** "{text}"')
286
 
287
- if len(submit_segments) == 0:
288
  st.success(
289
  f'No segments found! ({len(predictions)} ignored due to filters/settings)')
290
  return
 
205
  ts_type_id = st.selectbox(
206
  'Transcript type', TRANSCRIPT_TYPES.keys(), index=0, format_func=lambda x: TRANSCRIPT_TYPES[x]['label'], on_change=output.empty)
207
 
208
+ query_params = st.experimental_get_query_params()
209
+
210
+ video_id = None
211
+
212
+ if 'v' in query_params:
213
+ video_id = query_params['v'][0]
214
+
215
+ if video_id is None:
216
+ video_input = top.text_input('Video URL/ID:', on_change=output.empty)
217
+ else :
218
+ video_input = top.text_input('Video URL/ID:', on_change=output.empty,value = video_id)
219
  categories = top.multiselect('Categories:',
220
  CATGEGORY_OPTIONS.keys(),
221
  CATGEGORY_OPTIONS.keys(),
 
294
  st.write(f"**Confidence:** {confidence:.2f}%")
295
  st.write(f'**Text:** "{text}"')
296
 
297
+ if not submit_segments:
298
  st.success(
299
  f'No segments found! ({len(predictions)} ignored due to filters/settings)')
300
  return