jlsonon commited on
Commit
426b1fc
·
verified ·
1 Parent(s): 9166636

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -4
app.py CHANGED
@@ -110,20 +110,39 @@ def summarize(lecture_text, mode, pdfs):
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",
@@ -148,10 +167,17 @@ with gr.Blocks(css=css, theme="soft") as iface:
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()
 
110
  return result, pdf_path, docx_path
111
 
112
  # -------------------------------
113
+ # Full-Width Two-Column Interface (80% width)
114
  # -------------------------------
115
  css = """
116
  .gradio-container {
117
+ max-width: 80% !important;
118
+ margin: auto !important;
119
+ }
120
+ .toggle-btn {
121
+ background-color: #4a4a4a;
122
+ color: white;
123
+ border: none;
124
+ border-radius: 8px;
125
+ padding: 8px 16px;
126
+ cursor: pointer;
127
+ margin-bottom: 10px;
128
+ }
129
+ .toggle-btn:hover {
130
+ background-color: #6a6a6a;
131
  }
132
  """
133
 
134
+ # -------------------------------
135
+ # Gradio Interface with Theme Toggle
136
+ # -------------------------------
137
+ with gr.Blocks(css=css, theme="soft") as demo:
138
  gr.Markdown("## 🧠 AI Study Assistant by Jericho Sonon")
139
  gr.Markdown("Upload your lecture notes or PDFs to generate **Bullet Points**, **Flashcards**, or **MCQs** using OpenRouter GPT models.")
140
 
141
+ theme_state = gr.State("dark")
142
+
143
  with gr.Row(equal_height=True):
144
  with gr.Column(scale=1):
145
+ toggle_btn = gr.Button("🌙 Toggle Light/Dark Mode", elem_classes=["toggle-btn"])
146
  lecture_text = gr.Textbox(
147
  lines=35,
148
  label="Paste Lecture Text",
 
167
  pdf_file = gr.File(label="Download as PDF")
168
  docx_file = gr.File(label="Download as DOCX")
169
 
170
+ # Theme toggling
171
+ def toggle_theme(current):
172
+ new_theme = "light" if current == "dark" else "dark"
173
+ return gr.update(theme=new_theme), new_theme
174
+
175
+ toggle_btn.click(toggle_theme, inputs=theme_state, outputs=[demo, theme_state])
176
+
177
  generate_btn.click(
178
  summarize,
179
  inputs=[lecture_text, mode, pdfs],
180
  outputs=[generated_notes, pdf_file, docx_file]
181
  )
182
 
183
+ demo.launch()