Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -47,11 +47,11 @@ def predict_text(params):
|
|
| 47 |
pred_label = tf.argmax(logits, axis=1).numpy()[0]
|
| 48 |
|
| 49 |
label = {0: 'BUSINESS', 1: 'COMEDY', 2: 'CRIME', 3: 'FOOD & DRINK', 4: 'POLITICS', 5: 'SPORTS', 6: 'TRAVEL'}
|
| 50 |
-
result = {'text':text, 'label':label[pred_label]}
|
| 51 |
solutions.append(result)
|
| 52 |
|
| 53 |
result_url = f"{api}/{job_id}"
|
| 54 |
-
|
| 55 |
return json.dumps({"solutions":solutions}, indent=4)
|
| 56 |
|
| 57 |
|
|
|
|
| 47 |
pred_label = tf.argmax(logits, axis=1).numpy()[0]
|
| 48 |
|
| 49 |
label = {0: 'BUSINESS', 1: 'COMEDY', 2: 'CRIME', 3: 'FOOD & DRINK', 4: 'POLITICS', 5: 'SPORTS', 6: 'TRAVEL'}
|
| 50 |
+
result = {'text':text, 'label':[label[pred_label]]}
|
| 51 |
solutions.append(result)
|
| 52 |
|
| 53 |
result_url = f"{api}/{job_id}"
|
| 54 |
+
send_results_to_api(solutions, result_url)
|
| 55 |
return json.dumps({"solutions":solutions}, indent=4)
|
| 56 |
|
| 57 |
|