Use gr.File for JSON API to fix file path handling
Browse files
app.py
CHANGED
|
@@ -432,10 +432,10 @@ with gr.Blocks(css=custom_css, title="Pro-TeVA Tone Recognition") as demo:
|
|
| 432 |
show_label=True
|
| 433 |
)
|
| 434 |
|
| 435 |
-
# JSON API interface
|
| 436 |
json_api = gr.Interface(
|
| 437 |
fn=predict_tone_json,
|
| 438 |
-
inputs=gr.
|
| 439 |
outputs=gr.JSON(label="Prediction Result"),
|
| 440 |
api_name="predict_json",
|
| 441 |
title="Pro-TeVA JSON API",
|
|
|
|
| 432 |
show_label=True
|
| 433 |
)
|
| 434 |
|
| 435 |
+
# JSON API interface - use gr.File to properly handle file paths from API
|
| 436 |
json_api = gr.Interface(
|
| 437 |
fn=predict_tone_json,
|
| 438 |
+
inputs=gr.File(label="Audio File", file_types=["audio"]),
|
| 439 |
outputs=gr.JSON(label="Prediction Result"),
|
| 440 |
api_name="predict_json",
|
| 441 |
title="Pro-TeVA JSON API",
|