Spaces:
Sleeping
Sleeping
Adding textbook excerpts
Browse files- pages/textbook.py +35 -0
pages/textbook.py
CHANGED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from os import path
|
| 3 |
+
import pymupdf
|
| 4 |
+
|
| 5 |
+
st.set_page_config(page_title="LSAT Control - Textbook Tutor", page_icon="๐")
|
| 6 |
+
st.title("๐ LSAT Logical Reasoning - Group A")
|
| 7 |
+
|
| 8 |
+
# Upload the textbook PDF
|
| 9 |
+
pdf_file = path.abspath("utils/textbook.pdf")
|
| 10 |
+
if pdf_file:
|
| 11 |
+
doc = pymupdf.open(pdf_file, filetype="pdf")
|
| 12 |
+
|
| 13 |
+
# Topic selector
|
| 14 |
+
topic_pages = {
|
| 15 |
+
"The Basics of Logical Reasoning": [i for i in range(1,36)],
|
| 16 |
+
"Must Be True": [i for i in range(66,92)],
|
| 17 |
+
"Main Point Questions": [i for i in range(93,135)],
|
| 18 |
+
"Conditional Reasoning": [i for i in range(136,191)],
|
| 19 |
+
"Weaken Questions": [i for i in range(192,218)],
|
| 20 |
+
"Cause and Effect Reasoning": [i for i in range(219,238)],
|
| 21 |
+
"Strengthen, Justify, and Assumption": [i for i in range(239,309)],
|
| 22 |
+
"Find the Flaw": [i for i in range(349,379)],
|
| 23 |
+
"Evaluate the Argument": [i for i in range(429,439)],
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
topic = st.selectbox("Choose a topic:", list(topic_pages.keys()))
|
| 27 |
+
pages = topic_pages[topic]
|
| 28 |
+
|
| 29 |
+
# Extract and display text
|
| 30 |
+
text = ""
|
| 31 |
+
for p in pages:
|
| 32 |
+
text += doc[p].get_text()
|
| 33 |
+
|
| 34 |
+
st.subheader("๐ Concept Explanation")
|
| 35 |
+
st.write(text)
|