Update app.py
Browse files
app.py
CHANGED
@@ -207,6 +207,35 @@ def health_check():
|
|
207 |
}
|
208 |
return jsonify(health_status)
|
209 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
210 |
@app.route("/asr", methods=["POST"])
|
211 |
def transcribe_audio():
|
212 |
if asr_model is None or asr_processor is None:
|
|
|
207 |
}
|
208 |
return jsonify(health_status)
|
209 |
|
210 |
+
@app.route("/check_references", methods=["GET"])
|
211 |
+
def check_references():
|
212 |
+
"""Endpoint to check if reference files exist and are accessible"""
|
213 |
+
ref_patterns = ["mayap_a_abak", "mayap_a_ugtu", "mayap_a_gatpanapun",
|
214 |
+
"mayap_a_bengi", "komusta_ka"]
|
215 |
+
results = {}
|
216 |
+
|
217 |
+
for pattern in ref_patterns:
|
218 |
+
pattern_dir = os.path.join(REFERENCE_AUDIO_DIR, pattern)
|
219 |
+
if os.path.exists(pattern_dir):
|
220 |
+
wav_files = glob.glob(os.path.join(pattern_dir, "*.wav"))
|
221 |
+
results[pattern] = {
|
222 |
+
"exists": True,
|
223 |
+
"path": pattern_dir,
|
224 |
+
"file_count": len(wav_files),
|
225 |
+
"files": [os.path.basename(f) for f in wav_files]
|
226 |
+
}
|
227 |
+
else:
|
228 |
+
results[pattern] = {
|
229 |
+
"exists": False,
|
230 |
+
"path": pattern_dir
|
231 |
+
}
|
232 |
+
|
233 |
+
return jsonify({
|
234 |
+
"reference_audio_dir": REFERENCE_AUDIO_DIR,
|
235 |
+
"directory_exists": os.path.exists(REFERENCE_AUDIO_DIR),
|
236 |
+
"patterns": results
|
237 |
+
})
|
238 |
+
|
239 |
@app.route("/asr", methods=["POST"])
|
240 |
def transcribe_audio():
|
241 |
if asr_model is None or asr_processor is None:
|