Luigi commited on
Commit
7b7ed26
·
1 Parent(s): 4d88fce

bugfix on 'NoneType' object has no attribute 'caption'

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -150,9 +150,13 @@ if ctx.video_processor:
150
  # Placeholder for showing captions
151
  placeholder = st.empty()
152
  if ctx.state.playing:
153
- placeholder.markdown("**Caption:** _Waiting for inference…_")
154
  while ctx.state.playing:
155
- txt = ctx.video_processor.caption or "_…thinking…_"
 
 
 
 
156
  placeholder.markdown(f"**Caption:** {txt}")
157
  time.sleep(0.1)
158
  else:
 
150
  # Placeholder for showing captions
151
  placeholder = st.empty()
152
  if ctx.state.playing:
153
+ placeholder.markdown("**Caption:** _Waiting for first inference…_")
154
  while ctx.state.playing:
155
+ vp = ctx.video_processor
156
+ if vp is not None:
157
+ txt = vp.caption or "_…thinking…_"
158
+ else:
159
+ txt = "_…loading…_"
160
  placeholder.markdown(f"**Caption:** {txt}")
161
  time.sleep(0.1)
162
  else: