Spaces:
Runtime error
Runtime error
Alexander Seifert
commited on
Commit
·
d0fed63
1
Parent(s):
5ac50f7
update
Browse files
app.py
CHANGED
|
@@ -31,6 +31,7 @@ def run():
|
|
| 31 |
unsafe_allow_html=True,
|
| 32 |
)
|
| 33 |
|
|
|
|
| 34 |
submit_button = False
|
| 35 |
if "is_expanded" not in st.session_state:
|
| 36 |
st.session_state["is_expanded"] = True
|
|
@@ -64,7 +65,9 @@ def run():
|
|
| 64 |
submit_button = col2.button(
|
| 65 |
label="⚡ Transkribieren"
|
| 66 |
+ (" (Zugriffscode inkorrekt)" if not password_is_correct(password) else ""),
|
| 67 |
-
disabled=(
|
|
|
|
|
|
|
| 68 |
)
|
| 69 |
|
| 70 |
cutoff = audio_b64 = None
|
|
@@ -84,26 +87,28 @@ def run():
|
|
| 84 |
# time.sleep(1)
|
| 85 |
# my_bar.progress(percent_complete + 1)
|
| 86 |
|
|
|
|
| 87 |
with st.spinner("Transkription läuft..."):
|
| 88 |
transcription = transcribe(url, audio_b64, cutoff)
|
| 89 |
-
|
| 90 |
-
col1, col2 = st.columns([1, 1])
|
| 91 |
-
col1.download_button(
|
| 92 |
-
label="⬇️ Transkript",
|
| 93 |
-
data=transcription["text"],
|
| 94 |
-
file_name="transkript.txt",
|
| 95 |
-
mime="text/plain",
|
| 96 |
-
)
|
| 97 |
-
|
| 98 |
-
col2.download_button(
|
| 99 |
-
label="⬇️ OTR-Datei",
|
| 100 |
-
data=json.dumps(transcription["otr"], indent=2, ensure_ascii=False),
|
| 101 |
-
file_name="transkript.otr",
|
| 102 |
-
mime="application/json",
|
| 103 |
-
)
|
| 104 |
|
| 105 |
st.text_area("Transkript", transcription["text"], height=300)
|
| 106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
|
| 108 |
try:
|
| 109 |
run()
|
|
|
|
| 31 |
unsafe_allow_html=True,
|
| 32 |
)
|
| 33 |
|
| 34 |
+
running = False
|
| 35 |
submit_button = False
|
| 36 |
if "is_expanded" not in st.session_state:
|
| 37 |
st.session_state["is_expanded"] = True
|
|
|
|
| 65 |
submit_button = col2.button(
|
| 66 |
label="⚡ Transkribieren"
|
| 67 |
+ (" (Zugriffscode inkorrekt)" if not password_is_correct(password) else ""),
|
| 68 |
+
disabled=(
|
| 69 |
+
not password_is_correct(password) or (not audio_file and not url) or running
|
| 70 |
+
),
|
| 71 |
)
|
| 72 |
|
| 73 |
cutoff = audio_b64 = None
|
|
|
|
| 87 |
# time.sleep(1)
|
| 88 |
# my_bar.progress(percent_complete + 1)
|
| 89 |
|
| 90 |
+
running = True
|
| 91 |
with st.spinner("Transkription läuft..."):
|
| 92 |
transcription = transcribe(url, audio_b64, cutoff)
|
| 93 |
+
running = False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
|
| 95 |
st.text_area("Transkript", transcription["text"], height=300)
|
| 96 |
|
| 97 |
+
with st.expander("⬇️ Transkript herunterladen"):
|
| 98 |
+
st.download_button(
|
| 99 |
+
label="⬇️ Txt-Datei herunterladen",
|
| 100 |
+
data=transcription["text"],
|
| 101 |
+
file_name="transkript.txt",
|
| 102 |
+
mime="text/plain",
|
| 103 |
+
)
|
| 104 |
+
|
| 105 |
+
st.download_button(
|
| 106 |
+
label="⬇️ OTR-Datei herunterladen",
|
| 107 |
+
data=json.dumps(transcription["otr"], indent=2, ensure_ascii=False),
|
| 108 |
+
file_name="transkript.otr",
|
| 109 |
+
mime="application/json",
|
| 110 |
+
)
|
| 111 |
+
|
| 112 |
|
| 113 |
try:
|
| 114 |
run()
|