Create a flask endpoint that receives a post request from an HTML form to receive a recording and saves it to disk.
Provide the flask code and the associated HTML/JS
Here’s how you can build a Flask-based backend that receives an audio file from an HTML form and saves it to disk.
1️⃣ Flask Backend (app.py)
This Flask server will handle POST requests, receive the uploaded audio file, and save it locally.
2️⃣ Frontend (templates/index.html)
This page allows users to record audio and send it to the Flask backend.
How It Works
- User clicks "Start Recording" → The browser records audio.
- User clicks "Stop Recording" → The recording is stored in memory.
- User clicks "Upload" → The recorded audio is sent to the Flask server via Fetch API.
- Flask saves the file in the
uploads/folder.
Running the App
- Install dependencies:
- Start the Flask server:
- Open your browser and go to:
👉http://127.0.0.1:5000/
Would you like to extend this with speech-to-text transcription? 🚀
No comments:
Post a Comment