Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -162,34 +162,62 @@ def process_pdf(pdf_file, groq_api_key, google_api_key, cx, progress=gr.Progress
|
|
| 162 |
except Exception as e:
|
| 163 |
return None, None, f"β Error: {str(e)}"
|
| 164 |
|
| 165 |
-
|
|
|
|
|
|
|
|
|
|
| 166 |
gr.Markdown("""
|
| 167 |
# π LectureForge - AI Lecture Notes Generator
|
| 168 |
|
| 169 |
Transform textbook PDFs into detailed, illustrated lecture notes using AI.
|
| 170 |
|
| 171 |
-
**
|
| 172 |
-
|
| 173 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 174 |
""")
|
| 175 |
|
| 176 |
with gr.Row():
|
| 177 |
with gr.Column():
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 182 |
generate_btn = gr.Button("π Generate Notes", variant="primary")
|
| 183 |
|
| 184 |
with gr.Column():
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
|
|
|
| 188 |
|
| 189 |
gr.Markdown("""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 190 |
---
|
| 191 |
**Created by:** Ruben Santosh, Vignesh R Nair, Arko Chakraborty
|
| 192 |
-
Dayananda Sagar University, Bangalore
|
| 193 |
""")
|
| 194 |
|
| 195 |
generate_btn.click(
|
|
|
|
| 162 |
except Exception as e:
|
| 163 |
return None, None, f"β Error: {str(e)}"
|
| 164 |
|
| 165 |
+
# Create interface WITHOUT theme parameter (this was causing the error)
|
| 166 |
+
demo = gr.Blocks(title="LectureForge")
|
| 167 |
+
|
| 168 |
+
with demo:
|
| 169 |
gr.Markdown("""
|
| 170 |
# π LectureForge - AI Lecture Notes Generator
|
| 171 |
|
| 172 |
Transform textbook PDFs into detailed, illustrated lecture notes using AI.
|
| 173 |
|
| 174 |
+
**How to use:**
|
| 175 |
+
1. Get free API keys:
|
| 176 |
+
- [Groq API](https://console.groq.com) (6000 requests/day free)
|
| 177 |
+
- [Google API Key](https://console.cloud.google.com) + [Search Engine CX](https://programmablesearchengine.google.com)
|
| 178 |
+
2. Upload your textbook PDF (text-based, not scanned)
|
| 179 |
+
3. Enter your API credentials
|
| 180 |
+
4. Click "Generate Notes" and wait 2-4 minutes
|
| 181 |
+
5. Download your notes!
|
| 182 |
""")
|
| 183 |
|
| 184 |
with gr.Row():
|
| 185 |
with gr.Column():
|
| 186 |
+
gr.Markdown("### π€ Upload & Configure")
|
| 187 |
+
pdf_input = gr.File(label="π Upload PDF Textbook", file_types=[".pdf"])
|
| 188 |
+
groq_key = gr.Textbox(
|
| 189 |
+
label="π Groq API Key",
|
| 190 |
+
type="password",
|
| 191 |
+
placeholder="gsk_..."
|
| 192 |
+
)
|
| 193 |
+
google_key = gr.Textbox(
|
| 194 |
+
label="π Google API Key",
|
| 195 |
+
type="password",
|
| 196 |
+
placeholder="AIza..."
|
| 197 |
+
)
|
| 198 |
+
cx_input = gr.Textbox(
|
| 199 |
+
label="π Google Custom Search CX",
|
| 200 |
+
placeholder="Your search engine ID"
|
| 201 |
+
)
|
| 202 |
+
|
| 203 |
generate_btn = gr.Button("π Generate Notes", variant="primary")
|
| 204 |
|
| 205 |
with gr.Column():
|
| 206 |
+
gr.Markdown("### π₯ Download Results")
|
| 207 |
+
status_output = gr.Textbox(label="π Status", lines=8)
|
| 208 |
+
notes_output = gr.File(label="π Lecture Notes (.docx)")
|
| 209 |
+
summary_output = gr.File(label="π Summary (.docx)")
|
| 210 |
|
| 211 |
gr.Markdown("""
|
| 212 |
+
---
|
| 213 |
+
### βΉοΈ Tips
|
| 214 |
+
- Works best with text-based PDFs (not scanned images)
|
| 215 |
+
- Processing time: ~12-18 seconds per section
|
| 216 |
+
- Free API limits: Groq (6000 req/day), Google (100 searches/day)
|
| 217 |
+
|
| 218 |
---
|
| 219 |
**Created by:** Ruben Santosh, Vignesh R Nair, Arko Chakraborty
|
| 220 |
+
**Institution:** Dayananda Sagar University, Bangalore, India
|
| 221 |
""")
|
| 222 |
|
| 223 |
generate_btn.click(
|