Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -252,152 +252,6 @@ def process_youtube_video(url, keywords):
|
|
| 252 |
|
| 253 |
|
| 254 |
|
| 255 |
-
# # Gradio Interface
|
| 256 |
-
# with gr.Blocks(theme=gr.themes.Soft()) as app:
|
| 257 |
-
# # Login Page
|
| 258 |
-
# with gr.Group() as login_page:
|
| 259 |
-
# gr.Markdown("# π Educational Learning Management System")
|
| 260 |
-
# username = gr.Textbox(label="Username")
|
| 261 |
-
# password = gr.Textbox(label="Password", type="password")
|
| 262 |
-
# login_btn = gr.Button("Login", variant="primary")
|
| 263 |
-
# login_msg = gr.Markdown()
|
| 264 |
-
|
| 265 |
-
# # Main Interface
|
| 266 |
-
# with gr.Group(visible=False) as main_page:
|
| 267 |
-
# with gr.Row():
|
| 268 |
-
# with gr.Column(scale=1):
|
| 269 |
-
# gr.Markdown("### π Navigation")
|
| 270 |
-
# nav_dashboard = gr.Button("π Dashboard", variant="primary")
|
| 271 |
-
# nav_students = gr.Button("π₯ Students")
|
| 272 |
-
# nav_teachers = gr.Button("π¨βπ« Teachers")
|
| 273 |
-
# nav_courses = gr.Button("π Courses")
|
| 274 |
-
# nav_youtube = gr.Button("π₯ YouTube Tool")
|
| 275 |
-
# logout_btn = gr.Button("πͺ Logout", variant="stop")
|
| 276 |
-
|
| 277 |
-
# with gr.Column(scale=3):
|
| 278 |
-
# # Dashboard Content
|
| 279 |
-
# dashboard_page = gr.Group()
|
| 280 |
-
# with dashboard_page:
|
| 281 |
-
# gr.Markdown("## π Dashboard")
|
| 282 |
-
# gr.Markdown(f"""
|
| 283 |
-
# ### System Overview
|
| 284 |
-
# - π₯ Total Students: {len(students_data)}
|
| 285 |
-
# - π¨βπ« Total Teachers: {len(teachers_data)}
|
| 286 |
-
# - π Total Courses: {len(courses_data)}
|
| 287 |
-
|
| 288 |
-
# ### Quick Actions
|
| 289 |
-
# - View student performance
|
| 290 |
-
# - Access course materials
|
| 291 |
-
# - Generate learning insights
|
| 292 |
-
# """)
|
| 293 |
-
|
| 294 |
-
# # Students Content
|
| 295 |
-
# students_page = gr.Group(visible=False)
|
| 296 |
-
# with students_page:
|
| 297 |
-
# gr.Markdown("## π₯ Students")
|
| 298 |
-
# gr.DataFrame(
|
| 299 |
-
# value=students_data,
|
| 300 |
-
# headers=["ID", "Name", "Grade", "Program"]
|
| 301 |
-
# )
|
| 302 |
-
|
| 303 |
-
# # Teachers Content
|
| 304 |
-
# teachers_page = gr.Group(visible=False)
|
| 305 |
-
# with teachers_page:
|
| 306 |
-
# gr.Markdown("## π¨βπ« Teachers")
|
| 307 |
-
# gr.DataFrame(
|
| 308 |
-
# value=teachers_data,
|
| 309 |
-
# headers=["ID", "Name", "Subject", "Qualification"]
|
| 310 |
-
# )
|
| 311 |
-
|
| 312 |
-
# # Courses Content
|
| 313 |
-
# courses_page = gr.Group(visible=False)
|
| 314 |
-
# with courses_page:
|
| 315 |
-
# gr.Markdown("## π Courses")
|
| 316 |
-
# gr.DataFrame(
|
| 317 |
-
# value=courses_data,
|
| 318 |
-
# headers=["ID", "Name", "Instructor", "Level"]
|
| 319 |
-
# )
|
| 320 |
-
|
| 321 |
-
# # YouTube Tool Content
|
| 322 |
-
# youtube_page = gr.Group(visible=False)
|
| 323 |
-
# with youtube_page:
|
| 324 |
-
# gr.Markdown("## Agent for YouTube Content Exploration")
|
| 325 |
-
# with gr.Row():
|
| 326 |
-
# with gr.Column(scale=2):
|
| 327 |
-
# video_url = gr.Textbox(
|
| 328 |
-
# label="YouTube URL",
|
| 329 |
-
# placeholder="https://youtube.com/watch?v=..."
|
| 330 |
-
# )
|
| 331 |
-
# keywords = gr.Textbox(
|
| 332 |
-
# label="Keywords for Recommendations",
|
| 333 |
-
# placeholder="e.g., python programming, machine learning"
|
| 334 |
-
# )
|
| 335 |
-
# analyze_btn = gr.Button("π Analyze Video", variant="primary")
|
| 336 |
-
|
| 337 |
-
# with gr.Column(scale=1):
|
| 338 |
-
# video_thumbnail = gr.Image(label="Video Preview")
|
| 339 |
-
|
| 340 |
-
# with gr.Row():
|
| 341 |
-
# with gr.Column():
|
| 342 |
-
# summary = gr.Textbox(label="π Summary", lines=8)
|
| 343 |
-
# sentiment = gr.Textbox(label="π Content Sentiment")
|
| 344 |
-
# with gr.Column():
|
| 345 |
-
# recommendations = gr.Textbox(label="π― Related Videos", lines=10)
|
| 346 |
-
|
| 347 |
-
# def login_check(user, pwd):
|
| 348 |
-
# if USER_CREDENTIALS.get(user) == pwd:
|
| 349 |
-
# return {
|
| 350 |
-
# login_page: gr.update(visible=False),
|
| 351 |
-
# main_page: gr.update(visible=True),
|
| 352 |
-
# login_msg: ""
|
| 353 |
-
# }
|
| 354 |
-
# return {
|
| 355 |
-
# login_page: gr.update(visible=True),
|
| 356 |
-
# main_page: gr.update(visible=False),
|
| 357 |
-
# login_msg: "β Invalid credentials"
|
| 358 |
-
# }
|
| 359 |
-
|
| 360 |
-
# def show_page(page_name):
|
| 361 |
-
# updates = {
|
| 362 |
-
# dashboard_page: gr.update(visible=False),
|
| 363 |
-
# students_page: gr.update(visible=False),
|
| 364 |
-
# teachers_page: gr.update(visible=False),
|
| 365 |
-
# courses_page: gr.update(visible=False),
|
| 366 |
-
# youtube_page: gr.update(visible=False)
|
| 367 |
-
# }
|
| 368 |
-
# updates[page_name] = gr.update(visible=True)
|
| 369 |
-
# return updates
|
| 370 |
-
|
| 371 |
-
# # Event Handlers
|
| 372 |
-
# login_btn.click(
|
| 373 |
-
# login_check,
|
| 374 |
-
# inputs=[username, password],
|
| 375 |
-
# outputs=[login_page, main_page, login_msg]
|
| 376 |
-
# )
|
| 377 |
-
|
| 378 |
-
# nav_dashboard.click(lambda: show_page(dashboard_page), outputs=list(show_page(dashboard_page).keys()))
|
| 379 |
-
# nav_students.click(lambda: show_page(students_page), outputs=list(show_page(students_page).keys()))
|
| 380 |
-
# nav_teachers.click(lambda: show_page(teachers_page), outputs=list(show_page(teachers_page).keys()))
|
| 381 |
-
# nav_courses.click(lambda: show_page(courses_page), outputs=list(show_page(courses_page).keys()))
|
| 382 |
-
# nav_youtube.click(lambda: show_page(youtube_page), outputs=list(show_page(youtube_page).keys()))
|
| 383 |
-
|
| 384 |
-
# analyze_btn.click(
|
| 385 |
-
# process_youtube_video,
|
| 386 |
-
# inputs=[video_url, keywords],
|
| 387 |
-
# outputs=[video_thumbnail, summary, sentiment, recommendations]
|
| 388 |
-
# )
|
| 389 |
-
|
| 390 |
-
# logout_btn.click(
|
| 391 |
-
# lambda: {
|
| 392 |
-
# login_page: gr.update(visible=True),
|
| 393 |
-
# main_page: gr.update(visible=False)
|
| 394 |
-
# },
|
| 395 |
-
# outputs=[login_page, main_page]
|
| 396 |
-
# )
|
| 397 |
-
|
| 398 |
-
# if __name__ == "__main__":
|
| 399 |
-
# app.launch()
|
| 400 |
-
|
| 401 |
# Gradio Interface
|
| 402 |
with gr.Blocks(theme=gr.themes.Soft()) as app:
|
| 403 |
# Login Page
|
|
@@ -542,4 +396,5 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
|
|
| 542 |
)
|
| 543 |
|
| 544 |
if __name__ == "__main__":
|
| 545 |
-
app.launch()
|
|
|
|
|
|
| 252 |
|
| 253 |
|
| 254 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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