Update app.py
Browse files
app.py
CHANGED
@@ -204,13 +204,16 @@ if st.button("Классифицировать"):
|
|
204 |
|
205 |
cumulative_prob = 0
|
206 |
t = 0.95
|
207 |
-
|
208 |
-
if (top
|
209 |
-
|
210 |
-
|
211 |
-
|
|
|
|
|
|
|
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
|