Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -85,7 +85,7 @@ if 'flashcards' not in st.session_state:
|
|
| 85 |
st.session_state.flashcards = ""
|
| 86 |
|
| 87 |
# Display the title and introduction
|
| 88 |
-
st.title("
|
| 89 |
st.write("""
|
| 90 |
This application helps you process text by summarizing content,
|
| 91 |
extracting main points
|
|
@@ -166,32 +166,32 @@ if st.session_state.main_points:
|
|
| 166 |
)
|
| 167 |
|
| 168 |
# Flashcards
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
#
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
# st.download_button(
|
| 196 |
# label="Download Flashcards",
|
| 197 |
# data=st.session_state.flashcards,
|
|
|
|
| 85 |
st.session_state.flashcards = ""
|
| 86 |
|
| 87 |
# Display the title and introduction
|
| 88 |
+
st.title("InsightStarfleet")
|
| 89 |
st.write("""
|
| 90 |
This application helps you process text by summarizing content,
|
| 91 |
extracting main points
|
|
|
|
| 166 |
)
|
| 167 |
|
| 168 |
# Flashcards
|
| 169 |
+
if st.session_state.flashcards:
|
| 170 |
+
st.markdown("### Flashcards")
|
| 171 |
+
flashcards = st.session_state.flashcards.split("\n\n") # Assuming flashcards are separated by double newlines
|
| 172 |
+
st.markdown('<div class="flashcard-container">', unsafe_allow_html=True)
|
| 173 |
+
for card in flashcards:
|
| 174 |
+
try:
|
| 175 |
+
# Check if card contains both question and answer
|
| 176 |
+
if '\n' in card:
|
| 177 |
+
question, answer = card.split('\n', 1)
|
| 178 |
+
st.markdown(f"""
|
| 179 |
+
<div class="flashcard">
|
| 180 |
+
<div class="flashcard-inner">
|
| 181 |
+
<div class="flashcard-front">
|
| 182 |
+
<p>{question.strip()}</p>
|
| 183 |
+
</div>
|
| 184 |
+
<div class="flashcard-back">
|
| 185 |
+
<p>{answer.strip()}</p>
|
| 186 |
+
</div>
|
| 187 |
+
</div>
|
| 188 |
+
</div>
|
| 189 |
+
""", unsafe_allow_html=True)
|
| 190 |
+
else:
|
| 191 |
+
st.error("Invalid flashcard format. Each flashcard should be in 'question\\nanswer' format.")
|
| 192 |
+
except Exception as e:
|
| 193 |
+
st.error(f"Error processing flashcard: {e}")
|
| 194 |
+
st.markdown('</div>', unsafe_allow_html=True)
|
| 195 |
# st.download_button(
|
| 196 |
# label="Download Flashcards",
|
| 197 |
# data=st.session_state.flashcards,
|