magles commited on
Commit
970dcae
Β·
verified Β·
1 Parent(s): 5761365

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +40 -12
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
- with gr.Blocks(theme=gr.themes.Soft(), title="LectureForge") as demo:
 
 
 
166
  gr.Markdown("""
167
  # πŸŽ“ LectureForge - AI Lecture Notes Generator
168
 
169
  Transform textbook PDFs into detailed, illustrated lecture notes using AI.
170
 
171
- **Requirements:**
172
- - [Groq API Key](https://console.groq.com) (free: 6000 req/day)
173
- - [Google API Key](https://console.cloud.google.com) + [CX](https://programmablesearchengine.google.com)
 
 
 
 
 
174
  """)
175
 
176
  with gr.Row():
177
  with gr.Column():
178
- pdf_input = gr.File(label="πŸ“„ Upload PDF", file_types=[".pdf"])
179
- groq_key = gr.Textbox(label="πŸ”‘ Groq API Key", type="password", placeholder="gsk_...")
180
- google_key = gr.Textbox(label="πŸ”‘ Google API Key", type="password", placeholder="AIza...")
181
- cx_input = gr.Textbox(label="πŸ” Google CX", placeholder="Your search engine ID")
 
 
 
 
 
 
 
 
 
 
 
 
 
182
  generate_btn = gr.Button("πŸš€ Generate Notes", variant="primary")
183
 
184
  with gr.Column():
185
- status_output = gr.Textbox(label="πŸ“Š Status", lines=6)
186
- notes_output = gr.File(label="πŸ“ Lecture Notes")
187
- summary_output = gr.File(label="πŸ“‹ Summary")
 
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(