Update app.py
Browse files
app.py
CHANGED
@@ -32,10 +32,11 @@ audio_recorder_html = """
|
|
32 |
const reader = new FileReader();
|
33 |
reader.readAsDataURL(audioBlob);
|
34 |
reader.onloadend = () => {
|
|
|
35 |
fetch("/upload_audio", {
|
36 |
method: "POST",
|
37 |
headers: { "Content-Type": "application/json" },
|
38 |
-
body: JSON.stringify({ audio:
|
39 |
}).then(response => response.json()).then(data => {
|
40 |
document.getElementById("audio_url").value = data.audio_url;
|
41 |
});
|
@@ -62,7 +63,7 @@ if st.button("✅ Process Recorded Audio"):
|
|
62 |
audio_url = st.session_state.get("audio_url", None)
|
63 |
if audio_url:
|
64 |
# Convert Base64 audio to WAV format
|
65 |
-
audio_data = base64.b64decode(audio_url
|
66 |
audio_bytes = io.BytesIO(audio_data)
|
67 |
|
68 |
# ✅ Send recorded audio to Render API
|
|
|
32 |
const reader = new FileReader();
|
33 |
reader.readAsDataURL(audioBlob);
|
34 |
reader.onloadend = () => {
|
35 |
+
const base64Audio = reader.result.split(',')[1];
|
36 |
fetch("/upload_audio", {
|
37 |
method: "POST",
|
38 |
headers: { "Content-Type": "application/json" },
|
39 |
+
body: JSON.stringify({ audio: base64Audio })
|
40 |
}).then(response => response.json()).then(data => {
|
41 |
document.getElementById("audio_url").value = data.audio_url;
|
42 |
});
|
|
|
63 |
audio_url = st.session_state.get("audio_url", None)
|
64 |
if audio_url:
|
65 |
# Convert Base64 audio to WAV format
|
66 |
+
audio_data = base64.b64decode(audio_url)
|
67 |
audio_bytes = io.BytesIO(audio_data)
|
68 |
|
69 |
# ✅ Send recorded audio to Render API
|