Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -65,7 +65,7 @@ function_choices = ['Broadening Discussion',
|
|
| 65 |
default_choices = function_choices
|
| 66 |
|
| 67 |
fields: List[Field] = [
|
| 68 |
-
Field(name="patient", type="input_col", title="**Patient
|
| 69 |
Field(type="expander", title="**Session Transcription:** *(expand)*", children=[
|
| 70 |
Field(name="dialogue_name", type="input_col", title=""),
|
| 71 |
]),
|
|
@@ -155,7 +155,7 @@ def get_path():
|
|
| 155 |
|
| 156 |
def display_dialogue(hf_path: str):
|
| 157 |
txt = load_text(hf_path)
|
| 158 |
-
|
| 159 |
#st.markdown(
|
| 160 |
# f"<details><summary><b>Herr Laus</b></summary><div>{txt}</div></details><br>",
|
| 161 |
#unsafe_allow_html=True)
|
|
@@ -163,6 +163,15 @@ def display_dialogue(hf_path: str):
|
|
| 163 |
import html as py_html
|
| 164 |
from streamlit.components.v1 import html as st_html
|
| 165 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 166 |
def markdown_with_line_numbers(text: str, height: int = 500):
|
| 167 |
# Number *source lines* (not wrapped visual lines)
|
| 168 |
escaped = py_html.escape(text)
|
|
|
|
| 65 |
default_choices = function_choices
|
| 66 |
|
| 67 |
fields: List[Field] = [
|
| 68 |
+
Field(name="patient", type="input_col", title="**Patient:** "),
|
| 69 |
Field(type="expander", title="**Session Transcription:** *(expand)*", children=[
|
| 70 |
Field(name="dialogue_name", type="input_col", title=""),
|
| 71 |
]),
|
|
|
|
| 155 |
|
| 156 |
def display_dialogue(hf_path: str):
|
| 157 |
txt = load_text(hf_path)
|
| 158 |
+
display_dialogue_with_numbers(txt)
|
| 159 |
#st.markdown(
|
| 160 |
# f"<details><summary><b>Herr Laus</b></summary><div>{txt}</div></details><br>",
|
| 161 |
#unsafe_allow_html=True)
|
|
|
|
| 163 |
import html as py_html
|
| 164 |
from streamlit.components.v1 import html as st_html
|
| 165 |
|
| 166 |
+
def display_dialogue_with_numbers(text: str, title="Dialogue"):
|
| 167 |
+
with st.expander(f"{title} (line numbers)", expanded=True):
|
| 168 |
+
# optional: wrap long lines instead of horizontal scrolling
|
| 169 |
+
st.markdown(
|
| 170 |
+
"<style>.stCode pre {white-space: pre-wrap !important; word-break: break-word !important;}</style>",
|
| 171 |
+
unsafe_allow_html=True,
|
| 172 |
+
)
|
| 173 |
+
st.code(text, language="text", line_numbers=True)
|
| 174 |
+
|
| 175 |
def markdown_with_line_numbers(text: str, height: int = 500):
|
| 176 |
# Number *source lines* (not wrapped visual lines)
|
| 177 |
escaped = py_html.escape(text)
|