Spaces:
Sleeping
Sleeping
Update streamlit_app.py
Browse files- streamlit_app.py +6 -4
streamlit_app.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
|
| 2 |
import streamlit as st
|
| 3 |
import tempfile
|
| 4 |
from faster_whisper import WhisperModel
|
|
@@ -83,11 +82,14 @@ if st.session_state.srt_data:
|
|
| 83 |
|
| 84 |
with col2:
|
| 85 |
edited_text = st.text_area("✏️ Edit SRT Before Download", value=st.session_state.srt_data, height=300, key="editor")
|
| 86 |
-
|
|
|
|
| 87 |
rtl_style = "direction: rtl;" if st.session_state.text_dir == "rtl" else "direction: ltr;"
|
|
|
|
| 88 |
st.markdown(
|
| 89 |
f'<div style="{rtl_style} white-space: pre-wrap; border:1px solid #ccc; padding:1em; '
|
| 90 |
-
f'border-radius:5px; background:#f9f9f9; max-height:300px; overflow:auto">'
|
| 91 |
-
|
|
|
|
| 92 |
|
| 93 |
st.download_button("⬇️ Download .srt", edited_text, file_name="output.srt", mime="text/plain")
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import tempfile
|
| 3 |
from faster_whisper import WhisperModel
|
|
|
|
| 82 |
|
| 83 |
with col2:
|
| 84 |
edited_text = st.text_area("✏️ Edit SRT Before Download", value=st.session_state.srt_data, height=300, key="editor")
|
| 85 |
+
|
| 86 |
+
# Render live styled preview block
|
| 87 |
rtl_style = "direction: rtl;" if st.session_state.text_dir == "rtl" else "direction: ltr;"
|
| 88 |
+
styled_html = edited_text.replace("&", "&").replace("<", "<").replace(">", ">").replace("\n", "<br>")
|
| 89 |
st.markdown(
|
| 90 |
f'<div style="{rtl_style} white-space: pre-wrap; border:1px solid #ccc; padding:1em; '
|
| 91 |
+
f'border-radius:5px; background:#f9f9f9; max-height:300px; overflow:auto">{styled_html}</div>',
|
| 92 |
+
unsafe_allow_html=True
|
| 93 |
+
)
|
| 94 |
|
| 95 |
st.download_button("⬇️ Download .srt", edited_text, file_name="output.srt", mime="text/plain")
|