Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -33,17 +33,15 @@ def predict(title, summary, tokenizer, model):
|
|
33 |
prediction_probs.append(probs[classes[ind]])
|
34 |
sum_probs += probs[classes[ind]]
|
35 |
ind += 1
|
|
|
|
|
36 |
|
37 |
return prediction, prediction_probs
|
38 |
|
39 |
@st.cache(suppress_st_warning=True)
|
40 |
def get_results(prediction, prediction_probs):
|
41 |
-
|
42 |
-
|
43 |
-
return pd.DataFrame({
|
44 |
-
'Topic': prediction,
|
45 |
-
'Confidence': prediction_probs,
|
46 |
-
}).style.hide_index()
|
47 |
|
48 |
label_to_theme = {0: 'Computer science', 1: 'Economics', 2: 'Electrical Engineering and Systems Science', 3: 'Math',
|
49 |
4: 'Quantitative biology', 5: 'Quantitative Finance', 6: 'Statistics', 7: 'Physics'}
|
|
|
33 |
prediction_probs.append(probs[classes[ind]])
|
34 |
sum_probs += probs[classes[ind]]
|
35 |
ind += 1
|
36 |
+
for prob in prediction_probs:
|
37 |
+
prob = str("{:.2f}".format(100 * prob)) + "%"
|
38 |
|
39 |
return prediction, prediction_probs
|
40 |
|
41 |
@st.cache(suppress_st_warning=True)
|
42 |
def get_results(prediction, prediction_probs):
|
43 |
+
frame = pd.DataFrame({'Topic': prediction, 'Confidence': prediction_probs}).style.hide_index()
|
44 |
+
return frame
|
|
|
|
|
|
|
|
|
45 |
|
46 |
label_to_theme = {0: 'Computer science', 1: 'Economics', 2: 'Electrical Engineering and Systems Science', 3: 'Math',
|
47 |
4: 'Quantitative biology', 5: 'Quantitative Finance', 6: 'Statistics', 7: 'Physics'}
|