Spaces:
Running
Running
Oviya
commited on
Commit
·
6e93377
1
Parent(s):
abef1d2
fix
Browse files- Findingword.py +4 -2
Findingword.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
import openai
|
| 2 |
-
from flask import Flask, jsonify, request, send_from_directory, send_file, Blueprint, current_app
|
| 3 |
import os
|
| 4 |
from flask_cors import CORS
|
| 5 |
import io # for streaming S3 bytes in HF/AWS mode
|
|
@@ -87,7 +87,9 @@ def get_vocabulary_word_from_openai():
|
|
| 87 |
audio_file_path_or_name = generate_audio(word) # local path or just filename in AWS mode
|
| 88 |
|
| 89 |
# URL for frontend remains identical
|
| 90 |
-
audio_url = f"/static/audio/{os.path.basename(audio_file_path_or_name)}"
|
|
|
|
|
|
|
| 91 |
|
| 92 |
return jsonify({
|
| 93 |
"word": word,
|
|
|
|
| 1 |
import openai
|
| 2 |
+
from flask import Flask, jsonify, request, send_from_directory, send_file, Blueprint, current_app, url_for
|
| 3 |
import os
|
| 4 |
from flask_cors import CORS
|
| 5 |
import io # for streaming S3 bytes in HF/AWS mode
|
|
|
|
| 87 |
audio_file_path_or_name = generate_audio(word) # local path or just filename in AWS mode
|
| 88 |
|
| 89 |
# URL for frontend remains identical
|
| 90 |
+
# audio_url = f"/static/audio/{os.path.basename(audio_file_path_or_name)}"
|
| 91 |
+
audio_url = url_for("findingword.serve_audio",
|
| 92 |
+
filename=os.path.basename(audio_file_path_or_name))
|
| 93 |
|
| 94 |
return jsonify({
|
| 95 |
"word": word,
|