Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -184,7 +184,6 @@ def _read_md_any(path: str) -> str:
|
|
| 184 |
return Path(full).read_text(encoding="utf-8")
|
| 185 |
|
| 186 |
def _wrap_paragraph(text: str, width: int) -> list[str]:
|
| 187 |
-
"""Hard-wrap a single paragraph to exactly width chars per line (no hyphen breaks)."""
|
| 188 |
if not text.strip():
|
| 189 |
return [""]
|
| 190 |
return textwrap.wrap(
|
|
@@ -192,8 +191,9 @@ def _wrap_paragraph(text: str, width: int) -> list[str]:
|
|
| 192 |
width=width,
|
| 193 |
break_long_words=False,
|
| 194 |
break_on_hyphens=False,
|
| 195 |
-
|
| 196 |
-
drop_whitespace=False
|
|
|
|
| 197 |
) or [""]
|
| 198 |
|
| 199 |
def _md_dialogue_to_lines(md_text: str, width: int) -> list[str]:
|
|
@@ -329,7 +329,7 @@ def show_field(f: Field, index: int, data_collected):
|
|
| 329 |
display_image(os.path.join(input_repo_path, 'images', value))
|
| 330 |
elif f.name == 'dialogue_name':
|
| 331 |
#display_dialogue(os.path.join(input_repo_path, 'dialogues', value))
|
| 332 |
-
display_numbered_dialogue(os.path.join(input_repo_path, 'dialogues', value),
|
| 333 |
|
| 334 |
elif f.name == 'patient':
|
| 335 |
st.markdown(f"**Patient:** {value}")
|
|
|
|
| 184 |
return Path(full).read_text(encoding="utf-8")
|
| 185 |
|
| 186 |
def _wrap_paragraph(text: str, width: int) -> list[str]:
|
|
|
|
| 187 |
if not text.strip():
|
| 188 |
return [""]
|
| 189 |
return textwrap.wrap(
|
|
|
|
| 191 |
width=width,
|
| 192 |
break_long_words=False,
|
| 193 |
break_on_hyphens=False,
|
| 194 |
+
# important: don't carry spaces across lines
|
| 195 |
+
drop_whitespace=True, # ← was False
|
| 196 |
+
replace_whitespace=True # use normal collapsing
|
| 197 |
) or [""]
|
| 198 |
|
| 199 |
def _md_dialogue_to_lines(md_text: str, width: int) -> list[str]:
|
|
|
|
| 329 |
display_image(os.path.join(input_repo_path, 'images', value))
|
| 330 |
elif f.name == 'dialogue_name':
|
| 331 |
#display_dialogue(os.path.join(input_repo_path, 'dialogues', value))
|
| 332 |
+
display_numbered_dialogue(os.path.join(input_repo_path, 'dialogues', value), max_height_px=520)
|
| 333 |
|
| 334 |
elif f.name == 'patient':
|
| 335 |
st.markdown(f"**Patient:** {value}")
|