Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -50,6 +50,7 @@ audio_bytes = audio_recorder(
|
|
| 50 |
|
| 51 |
# Process new audio only if it's different from last time
|
| 52 |
if audio_bytes:
|
|
|
|
| 53 |
current_hash = hashlib.md5(audio_bytes).hexdigest()
|
| 54 |
if current_hash != st.session_state.last_audio_hash:
|
| 55 |
st.session_state.last_audio_hash = current_hash
|
|
@@ -57,11 +58,13 @@ if audio_bytes:
|
|
| 57 |
audio_input = process_audio(audio_bytes)
|
| 58 |
whisper = load_model()
|
| 59 |
transcribed_text = whisper(audio_input)["text"]
|
|
|
|
| 60 |
|
| 61 |
# Append new transcription only if different
|
| 62 |
if (not st.session_state.text_input.endswith(transcribed_text.strip()) and
|
| 63 |
len(transcribed_text.strip()) > 0):
|
| 64 |
st.session_state.text_input += " " + transcribed_text
|
|
|
|
| 65 |
st.rerun()
|
| 66 |
|
| 67 |
except Exception as e:
|
|
|
|
| 50 |
|
| 51 |
# Process new audio only if it's different from last time
|
| 52 |
if audio_bytes:
|
| 53 |
+
st.info("🎤 Audio received!")
|
| 54 |
current_hash = hashlib.md5(audio_bytes).hexdigest()
|
| 55 |
if current_hash != st.session_state.last_audio_hash:
|
| 56 |
st.session_state.last_audio_hash = current_hash
|
|
|
|
| 58 |
audio_input = process_audio(audio_bytes)
|
| 59 |
whisper = load_model()
|
| 60 |
transcribed_text = whisper(audio_input)["text"]
|
| 61 |
+
st.info(f"📝 Transcribed: {transcribed_text}")
|
| 62 |
|
| 63 |
# Append new transcription only if different
|
| 64 |
if (not st.session_state.text_input.endswith(transcribed_text.strip()) and
|
| 65 |
len(transcribed_text.strip()) > 0):
|
| 66 |
st.session_state.text_input += " " + transcribed_text
|
| 67 |
+
st.success("✅ Text added to box!")
|
| 68 |
st.rerun()
|
| 69 |
|
| 70 |
except Exception as e:
|