Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -44,29 +44,19 @@ def process_audio(audio_bytes):
|
|
44 |
st.title("🎤 Audio Transkription")
|
45 |
st.info("Funktioniert auf Hugging Face Spaces!")
|
46 |
|
47 |
-
|
48 |
-
|
49 |
-
"
|
50 |
-
type=
|
51 |
-
accept_multiple_files=False,
|
52 |
-
help="Klicken Sie auf 'Browse Files' und wählen Sie im Browser 'Take a recording'"
|
53 |
)
|
54 |
|
55 |
-
if
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
st.subheader("Transkription:")
|
66 |
-
st.success(result)
|
67 |
-
|
68 |
-
# Audio-Player anzeigen
|
69 |
-
st.audio(audio_bytes, format="audio/wav")
|
70 |
-
|
71 |
-
except Exception as e:
|
72 |
-
st.error(f"Fehler: {str(e)}")
|
|
|
44 |
st.title("🎤 Audio Transkription")
|
45 |
st.info("Funktioniert auf Hugging Face Spaces!")
|
46 |
|
47 |
+
|
48 |
+
audio_bytes = st.audio_input(
|
49 |
+
"Oder sprechen Sie jetzt:",
|
50 |
+
type="wav"
|
|
|
|
|
51 |
)
|
52 |
|
53 |
+
if audio_bytes:
|
54 |
+
# Verarbeitung Mikrofonaufnahme
|
55 |
+
try:
|
56 |
+
# Konvertiere Bytes in Audio-Daten
|
57 |
+
audio_io = io.BytesIO(audio_bytes)
|
58 |
+
audio_data = sf.read(audio_io)
|
59 |
+
transcription = processaudio(audio_data)
|
60 |
+
sr_outputs.text(transcription)
|
61 |
+
except Exception as e:
|
62 |
+
sr_outputs.text(f"Fehler bei der Aufnahmeverarbeitung: {str(e)}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|