tanthinhdt commited on
Commit
56ec45c
·
verified ·
1 Parent(s): 905021a

update(app): adjust output message

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -68,10 +68,14 @@ def inference(
68
 
69
  progress(1/2, desc='Getting predictions')
70
  predictions = get_predictions(inputs=inputs, model=model)
71
- output_message = ''
72
- for i, prediction in enumerate(predictions):
73
- output_message += f'{i}. {prediction["label"]} ({prediction["score"]:2f})\n'
74
- output_message = output_message.strip()
 
 
 
 
75
 
76
  progress(1/2, desc='Completed')
77
 
 
68
 
69
  progress(1/2, desc='Getting predictions')
70
  predictions = get_predictions(inputs=inputs, model=model)
71
+
72
+ if len(predictions) == 0:
73
+ output_message = 'No sign language detected in the video. Please try again.'
74
+ else:
75
+ output_message = 'The top-3 predictions are:\n'
76
+ for i, prediction in enumerate(predictions):
77
+ output_message += f'{i+1}. {prediction["label"]} ({prediction["score"]:2f})\n'
78
+ output_message = output_message.strip()
79
 
80
  progress(1/2, desc='Completed')
81