Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -110,39 +110,14 @@ def summarize(lecture_text, mode, pdfs):
|
|
| 110 |
return result, pdf_path, docx_path
|
| 111 |
|
| 112 |
# -------------------------------
|
| 113 |
-
#
|
| 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(
|
| 138 |
-
gr.Markdown("##
|
| 139 |
-
gr.Markdown("Upload your lecture notes or PDFs to generate **
|
| 140 |
|
| 141 |
-
|
| 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,17 +142,10 @@ with gr.Blocks(css=css, theme="soft") as demo:
|
|
| 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 |
-
|
|
|
|
| 110 |
return result, pdf_path, docx_path
|
| 111 |
|
| 112 |
# -------------------------------
|
| 113 |
+
# Gradio Layout (Two-Column)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
# -------------------------------
|
| 115 |
+
with gr.Blocks(theme="soft") as iface:
|
| 116 |
+
gr.Markdown("## AI Study Assistant by Jericho Sonon")
|
| 117 |
+
gr.Markdown("Upload your lecture notes or PDFs to generate **bullet points**, **flashcards**, or **MCQs** using OpenRouter GPT models.")
|
| 118 |
|
| 119 |
+
with gr.Row():
|
|
|
|
|
|
|
| 120 |
with gr.Column(scale=1):
|
|
|
|
| 121 |
lecture_text = gr.Textbox(
|
| 122 |
lines=35,
|
| 123 |
label="Paste Lecture Text",
|
|
|
|
| 142 |
pdf_file = gr.File(label="Download as PDF")
|
| 143 |
docx_file = gr.File(label="Download as DOCX")
|
| 144 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 145 |
generate_btn.click(
|
| 146 |
summarize,
|
| 147 |
inputs=[lecture_text, mode, pdfs],
|
| 148 |
outputs=[generated_notes, pdf_file, docx_file]
|
| 149 |
)
|
| 150 |
|
| 151 |
+
iface.launch()
|