Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -56,8 +56,10 @@ def predict_text(params):
|
|
| 56 |
pred = bert_model.predict([input_ids, token_type_ids, attention_mask])
|
| 57 |
logits = pred.logits
|
| 58 |
pred_label = tf.argmax(logits, axis=1).numpy()[0]
|
|
|
|
|
|
|
| 59 |
|
| 60 |
-
label = {0: 'BUSINESS', 1: 'COMEDY', 2: 'CRIME', 3: 'FOOD & DRINK', 4: 'POLITICS', 5: 'SPORTS', 6: 'TRAVEL'}
|
| 61 |
result = {'text':text, 'label':[label[pred_label]], "qcUser" : None,"normalfileID":file_id}
|
| 62 |
solutions.append(result)
|
| 63 |
|
|
|
|
| 56 |
pred = bert_model.predict([input_ids, token_type_ids, attention_mask])
|
| 57 |
logits = pred.logits
|
| 58 |
pred_label = tf.argmax(logits, axis=1).numpy()[0]
|
| 59 |
+
if not pred_label:
|
| 60 |
+
predict_label = 7
|
| 61 |
|
| 62 |
+
label = {0: 'BUSINESS', 1: 'COMEDY', 2: 'CRIME', 3: 'FOOD & DRINK', 4: 'POLITICS', 5: 'SPORTS', 6: 'TRAVEL', 7: 'None'}
|
| 63 |
result = {'text':text, 'label':[label[pred_label]], "qcUser" : None,"normalfileID":file_id}
|
| 64 |
solutions.append(result)
|
| 65 |
|