Update app.py
Browse files
app.py
CHANGED
|
@@ -18,12 +18,10 @@ if uploaded_file and method != "Select a method":
|
|
| 18 |
pattern = r'(^#+ .*$)'
|
| 19 |
parts = re.split(pattern, text, flags=re.MULTILINE)
|
| 20 |
sections = []
|
| 21 |
-
|
| 22 |
for i in range(1, len(parts), 2):
|
| 23 |
header = parts[i].strip()
|
| 24 |
content = parts[i + 1].strip() if i + 1 < len(parts) else ""
|
| 25 |
sections.append({"header": header, "content": content})
|
| 26 |
-
|
| 27 |
return sections
|
| 28 |
|
| 29 |
st.subheader("📦 Formatted Output")
|
|
@@ -32,3 +30,16 @@ if uploaded_file and method != "Select a method":
|
|
| 32 |
if section["header"]:
|
| 33 |
st.markdown(f"#### {section['header']}")
|
| 34 |
st.markdown(section["content"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
pattern = r'(^#+ .*$)'
|
| 19 |
parts = re.split(pattern, text, flags=re.MULTILINE)
|
| 20 |
sections = []
|
|
|
|
| 21 |
for i in range(1, len(parts), 2):
|
| 22 |
header = parts[i].strip()
|
| 23 |
content = parts[i + 1].strip() if i + 1 < len(parts) else ""
|
| 24 |
sections.append({"header": header, "content": content})
|
|
|
|
| 25 |
return sections
|
| 26 |
|
| 27 |
st.subheader("📦 Formatted Output")
|
|
|
|
| 30 |
if section["header"]:
|
| 31 |
st.markdown(f"#### {section['header']}")
|
| 32 |
st.markdown(section["content"])
|
| 33 |
+
|
| 34 |
+
elif method == "Outline Method":
|
| 35 |
+
st.subheader("📝 Outline Method Output")
|
| 36 |
+
|
| 37 |
+
sections = markdown_text.strip().split("\n\n")
|
| 38 |
+
for section in sections:
|
| 39 |
+
lines = section.strip().split("\n")
|
| 40 |
+
if lines:
|
| 41 |
+
title = lines[0]
|
| 42 |
+
content = "\n".join(lines[1:]) if len(lines) > 1 else ""
|
| 43 |
+
with st.container(border=True):
|
| 44 |
+
st.markdown(f"**{title}**")
|
| 45 |
+
st.markdown(content)
|