Update app.py
Browse files
app.py
CHANGED
|
@@ -43,3 +43,15 @@ if uploaded_file and method != "Select a method":
|
|
| 43 |
with st.container(border=True):
|
| 44 |
st.markdown(f"**{title}**")
|
| 45 |
st.markdown(content)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
with st.container(border=True):
|
| 44 |
st.markdown(f"**{title}**")
|
| 45 |
st.markdown(content)
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
elif method == "Flashcard":
|
| 49 |
+
st.subheader("📝 Flashcards")
|
| 50 |
+
# Extract Q&A pairs using regex
|
| 51 |
+
pattern = r"- \*\*Q: (.*?)\*\*.*?\*\*A:\*\* (.*?)\n"
|
| 52 |
+
qa_pairs = re.findall(pattern, markdown_text, re.DOTALL)
|
| 53 |
+
|
| 54 |
+
# Display in expandable flashcards
|
| 55 |
+
for i, (question, answer) in enumerate(qa_pairs, 1):
|
| 56 |
+
with st.expander(f"Q{i}: {question.strip()}"):
|
| 57 |
+
st.markdown(f"**Answer:** {answer.strip()}")
|