Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,7 +8,8 @@ from crewai_flashcard import generate_flashcards
|
|
| 8 |
st.title("Study Companion: Flashcard Generator & Practice")
|
| 9 |
|
| 10 |
# Create two tabs: one to generate flashcards from a PDF, and one to practice them.
|
| 11 |
-
tab_gen
|
|
|
|
| 12 |
|
| 13 |
# Initialize session state for flashcards and flashcard practice
|
| 14 |
if "flashcards" not in st.session_state:
|
|
@@ -24,8 +25,8 @@ if "show_answer" not in st.session_state:
|
|
| 24 |
with tab_gen:
|
| 25 |
st.header("Generate Flashcards from PDF")
|
| 26 |
uploaded_file = st.file_uploader("Upload PDF file", type="pdf")
|
| 27 |
-
page_range = st.text_input("Enter page range to extract (e.g., '1-5' or '1'):")
|
| 28 |
-
flashcard_count = st.number_input("Number of flashcards to generate:", min_value=1, max_value=
|
| 29 |
|
| 30 |
if uploaded_file is not None and page_range:
|
| 31 |
# Save the uploaded file to a temporary location
|
|
@@ -52,7 +53,7 @@ with tab_gen:
|
|
| 52 |
st.error(f"Error parsing flashcards: {e}")
|
| 53 |
|
| 54 |
# --- Tab 2: Practice Flashcards ---
|
| 55 |
-
with tab_practice:
|
| 56 |
st.header("Practice Flashcards")
|
| 57 |
if st.session_state.flashcards:
|
| 58 |
total_cards = len(st.session_state.flashcards)
|
|
|
|
| 8 |
st.title("Study Companion: Flashcard Generator & Practice")
|
| 9 |
|
| 10 |
# Create two tabs: one to generate flashcards from a PDF, and one to practice them.
|
| 11 |
+
tab_gen = st.tabs(["Generate Flashcards"])
|
| 12 |
+
#tab_gen, tab_practice = st.tabs(["Generate Flashcards", "Practice Flashcards"])
|
| 13 |
|
| 14 |
# Initialize session state for flashcards and flashcard practice
|
| 15 |
if "flashcards" not in st.session_state:
|
|
|
|
| 25 |
with tab_gen:
|
| 26 |
st.header("Generate Flashcards from PDF")
|
| 27 |
uploaded_file = st.file_uploader("Upload PDF file", type="pdf")
|
| 28 |
+
#page_range = st.text_input("Enter page range to extract (e.g., '1-5' or '1'):")
|
| 29 |
+
flashcard_count = st.number_input("Number of flashcards to generate:", min_value=1, max_value=5, value=3, step=1)
|
| 30 |
|
| 31 |
if uploaded_file is not None and page_range:
|
| 32 |
# Save the uploaded file to a temporary location
|
|
|
|
| 53 |
st.error(f"Error parsing flashcards: {e}")
|
| 54 |
|
| 55 |
# --- Tab 2: Practice Flashcards ---
|
| 56 |
+
#with tab_practice:
|
| 57 |
st.header("Practice Flashcards")
|
| 58 |
if st.session_state.flashcards:
|
| 59 |
total_cards = len(st.session_state.flashcards)
|