Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -6,10 +6,13 @@ learn = load_learner("model.pkl")
|
|
6 |
|
7 |
def predict(inp:str):
|
8 |
preds = learn.blurr_predict([inp])[0]
|
|
|
9 |
preds_dict = dict(zip(preds['class_labels'], preds['probs']))
|
10 |
preds_dict = sorted(preds_dict.items(), key=operator.itemgetter(1), reverse=True)[:5]
|
|
|
11 |
preds_df = pd.DataFrame(preds_dict, columns=['Specialty', 'Probability'])
|
12 |
-
|
|
|
13 |
return preds_df
|
14 |
|
15 |
text = gr.inputs.Textbox()
|
|
|
6 |
|
7 |
def predict(inp:str):
|
8 |
preds = learn.blurr_predict([inp])[0]
|
9 |
+
|
10 |
preds_dict = dict(zip(preds['class_labels'], preds['probs']))
|
11 |
preds_dict = sorted(preds_dict.items(), key=operator.itemgetter(1), reverse=True)[:5]
|
12 |
+
|
13 |
preds_df = pd.DataFrame(preds_dict, columns=['Specialty', 'Probability'])
|
14 |
+
preds_df['Probability'] = preds_df['Probability'].apply(lambda x: f"{x*100:.4f}%")
|
15 |
+
|
16 |
return preds_df
|
17 |
|
18 |
text = gr.inputs.Textbox()
|