1NEYRON1 commited on
Commit
ccdced3
·
1 Parent(s): b8bf2e4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -6
app.py CHANGED
@@ -204,13 +204,16 @@ if st.button("Классифицировать"):
204
 
205
  cumulative_prob = 0
206
  t = 0.95
207
- if top:
208
- if (top >= 0) and (top <= 1):
209
- t = top
210
- elif (top > 1):
211
- t = top / 100
 
 
 
212
 
213
- st.subheader(f'Результаты классификации (top {t * 100}%):')
214
  for label, score in results:
215
  st.write(f"- **{label}**: {score:.4f}")
216
  cumulative_prob += score
 
204
 
205
  cumulative_prob = 0
206
  t = 0.95
207
+ try:
208
+ if int(top):
209
+ if (int(top) >= 0) and (int(top) <= 1):
210
+ t = int(top)
211
+ elif (int(top) > 1):
212
+ t = int(top) / 100
213
+ except ValueError:
214
+ pass
215
 
216
+ st.subheader(f'Результаты классификации (top {min(t * 100, 100)}%):')
217
  for label, score in results:
218
  st.write(f"- **{label}**: {score:.4f}")
219
  cumulative_prob += score