JustusI commited on
Commit
4616d03
·
verified ·
1 Parent(s): c7b7427

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -5,7 +5,7 @@ import random
5
  from crewai_flashcard import generate_flashcards
6
 
7
  # --- Set up the Streamlit app ---
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"])
@@ -28,7 +28,7 @@ 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
33
  with tempfile.NamedTemporaryFile(delete=False, suffix=".pdf") as tmp:
34
  tmp.write(uploaded_file.read())
@@ -39,7 +39,7 @@ if uploaded_file is not None and page_range:
39
  if st.button("Generate Flashcards"):
40
  with st.spinner("Generating flashcards..."):
41
  # This function runs the CrewAI system and writes flashcards to JSON output
42
- flashcards_json = generate_flashcards(pdf_file_path, page_range, flashcard_count)
43
  st.markdown(flashcards_json)
44
  try:
45
  # Parse the JSON output and save it in session state
 
5
  from crewai_flashcard import generate_flashcards
6
 
7
  # --- Set up the Streamlit app ---
8
+ st.title("Study Companion: Flashcard Generator")
9
 
10
  # Create two tabs: one to generate flashcards from a PDF, and one to practice them.
11
  #tab_gen = st.tabs(["Generate Flashcards"])
 
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
33
  with tempfile.NamedTemporaryFile(delete=False, suffix=".pdf") as tmp:
34
  tmp.write(uploaded_file.read())
 
39
  if st.button("Generate Flashcards"):
40
  with st.spinner("Generating flashcards..."):
41
  # This function runs the CrewAI system and writes flashcards to JSON output
42
+ flashcards_json = generate_flashcards(pdf_file_path, flashcard_count)#generate_flashcards(pdf_file_path, page_range, flashcard_count)
43
  st.markdown(flashcards_json)
44
  try:
45
  # Parse the JSON output and save it in session state