Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -40,53 +40,6 @@ def health_check():
|
|
40 |
return jsonify({"status": "success", "message": "API is running successfully!"}), 200
|
41 |
|
42 |
|
43 |
-
# @app.route('/process-audio', methods=['POST'])
|
44 |
-
# def process_audio():
|
45 |
-
# # print("GOT THE PROCESS AUDIO REQUEST, ANIKET")
|
46 |
-
|
47 |
-
# if 'audio' not in request.files:
|
48 |
-
# return jsonify({"error": "No audio file provided"}), 400
|
49 |
-
|
50 |
-
# audio_file = request.files['audio']
|
51 |
-
# # print("AUDIO FILE NAME: ", audio_file)
|
52 |
-
|
53 |
-
# temp_audio_path = None
|
54 |
-
# try:
|
55 |
-
# print("STARTING TRANSCRIPTION, ANIKET")
|
56 |
-
|
57 |
-
# # Step 1: Save the audio file temporarily to a specific location
|
58 |
-
# with tempfile.NamedTemporaryFile(delete=False, suffix='.wav') as temp_audio_file:
|
59 |
-
# temp_audio_path = temp_audio_file.name # Get the file path
|
60 |
-
# temp_audio_file.write(audio_file.read()) # Write the uploaded audio to the temp file
|
61 |
-
|
62 |
-
# # print(f"Temporary audio file saved at: {temp_audio_path}")
|
63 |
-
|
64 |
-
# # Step 2: Transcribe the uploaded audio file synchronously
|
65 |
-
# transcription = transcribe_audio(temp_audio_path)
|
66 |
-
|
67 |
-
# # print("BEFORE THE transcription FAILED ERROR, CHECKING IF I GOT THE TRANSCRIPTION", transcription)
|
68 |
-
|
69 |
-
# if not transcription:
|
70 |
-
# return jsonify({"error": "Audio transcription failed"}), 500
|
71 |
-
|
72 |
-
# # print("GOT THE transcription")
|
73 |
-
|
74 |
-
# # Step 3: Generate structured recipe information using Gemini API synchronously
|
75 |
-
# # print("Starting the GEMINI REQUEST TO STRUCTURE IT")
|
76 |
-
# structured_data = query_gemini_api(transcription)
|
77 |
-
|
78 |
-
# # print("GOT THE STRUCTURED DATA", structured_data)
|
79 |
-
# # Step 4: Return the structured data
|
80 |
-
# return jsonify(structured_data)
|
81 |
-
|
82 |
-
# except Exception as e:
|
83 |
-
# return jsonify({"error": str(e)}), 500
|
84 |
-
|
85 |
-
# finally:
|
86 |
-
# # Clean up the temporary WAV file
|
87 |
-
# if temp_audio_path and os.path.exists(temp_audio_path):
|
88 |
-
# os.remove(temp_audio_path)
|
89 |
-
# print(f"Temporary WAV file deleted: {temp_audio_path}")
|
90 |
|
91 |
def download_audio(url, temp_audio_path):
|
92 |
"""Download audio (WAV format) from the given URL and save it to temp_audio_path."""
|
|
|
40 |
return jsonify({"status": "success", "message": "API is running successfully!"}), 200
|
41 |
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
|
44 |
def download_audio(url, temp_audio_path):
|
45 |
"""Download audio (WAV format) from the given URL and save it to temp_audio_path."""
|