jlsonon commited on
Commit
9166636
·
verified ·
1 Parent(s): 00d0106

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +43 -18
app.py CHANGED
@@ -110,23 +110,48 @@ def summarize(lecture_text, mode, pdfs):
110
  return result, pdf_path, docx_path
111
 
112
  # -------------------------------
113
- # Gradio Interface
114
- # -------------------------------
115
- iface = gr.Interface(
116
- fn=summarize,
117
- inputs=[
118
- gr.Textbox(lines=8, label="Paste Lecture Text"),
119
- gr.Radio(["Bullet Points", "Flashcards", "MCQs"], label="Output Mode"),
120
- gr.File(file_count="multiple", label="Upload PDFs (optional)")
121
- ],
122
- outputs=[
123
- gr.Textbox(label="Generated Notes", lines=15),
124
- gr.File(label="Download as PDF"),
125
- gr.File(label="Download as DOCX")
126
- ],
127
- title="AI Study Assistant by Jericho Sonon",
128
- description="Upload your lecture notes or PDFs to generate bullet points, flashcards, or MCQs using OpenRouter GPT models.",
129
- theme="soft"
130
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
 
132
  iface.launch()
 
110
  return result, pdf_path, docx_path
111
 
112
  # -------------------------------
113
+ # Full-Width Two-Column Interface
114
+ # -------------------------------
115
+ css = """
116
+ .gradio-container {
117
+ max-width: 100% !important;
118
+ }
119
+ """
120
+
121
+ with gr.Blocks(css=css, theme="soft") as iface:
122
+ gr.Markdown("## 🧠 AI Study Assistant by Jericho Sonon")
123
+ gr.Markdown("Upload your lecture notes or PDFs to generate **Bullet Points**, **Flashcards**, or **MCQs** using OpenRouter GPT models.")
124
+
125
+ with gr.Row(equal_height=True):
126
+ with gr.Column(scale=1):
127
+ lecture_text = gr.Textbox(
128
+ lines=35,
129
+ label="Paste Lecture Text",
130
+ placeholder="Paste your lecture or notes here...",
131
+ interactive=True
132
+ )
133
+ mode = gr.Radio(
134
+ ["Bullet Points", "Flashcards", "MCQs"],
135
+ label="Output Mode",
136
+ value="Bullet Points"
137
+ )
138
+ pdfs = gr.File(file_count="multiple", label="Upload PDFs (optional)")
139
+ generate_btn = gr.Button("Generate Study Notes", variant="primary")
140
+
141
+ with gr.Column(scale=1):
142
+ generated_notes = gr.Textbox(
143
+ label="Generated Notes",
144
+ lines=35,
145
+ interactive=True,
146
+ show_copy_button=True
147
+ )
148
+ pdf_file = gr.File(label="Download as PDF")
149
+ docx_file = gr.File(label="Download as DOCX")
150
+
151
+ generate_btn.click(
152
+ summarize,
153
+ inputs=[lecture_text, mode, pdfs],
154
+ outputs=[generated_notes, pdf_file, docx_file]
155
+ )
156
 
157
  iface.launch()