banao-tech commited on
Commit
65d60ca
Β·
verified Β·
1 Parent(s): d90c34f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +117 -76
app.py CHANGED
@@ -321,61 +321,38 @@ with st.form("personalization_form", clear_on_submit=False):
321
  # Topics Section
322
  st.markdown('<div class="section-header">πŸ“‹ Topics Configuration</div>', unsafe_allow_html=True)
323
 
324
- # Option to choose single or multiple topics
325
- topic_mode = st.radio(
326
- "Select Topic Mode",
327
- ["Single Topic", "Multiple Topics"],
328
- horizontal=True,
329
- help="Choose whether to process one topic or multiple topics"
330
- )
331
-
332
- if topic_mode == "Single Topic":
333
- st.markdown('<div class="topic-container">', unsafe_allow_html=True)
334
- st.markdown('<div class="topic-header">πŸ“ Single Topic Configuration</div>', unsafe_allow_html=True)
335
 
336
- col1, col2 = st.columns(2)
337
  with col1:
338
- single_topic_title = st.text_input("Topic Title", value="What is Flask", help="Enter the topic title", key="single_topic")
339
- with col2:
340
- single_chapter_title = st.text_input("Chapter Title", value="Introduction to Flask", help="Enter the chapter title", key="single_chapter")
 
 
 
 
341
 
342
- st.markdown('</div>', unsafe_allow_html=True)
 
 
 
 
 
 
 
343
 
344
- else:
345
- st.markdown("### πŸ“š Multiple Topics Configuration")
 
 
 
 
346
 
347
- # Display existing topics with better styling
348
- for i, topic in enumerate(st.session_state.topics_list):
349
- st.markdown(f'<div class="topic-container">', unsafe_allow_html=True)
350
- st.markdown(f'<div class="topic-header">πŸ“– Topic {i+1}</div>', unsafe_allow_html=True)
351
-
352
- col1, col2, col3 = st.columns([3, 3, 1])
353
- with col1:
354
- topic_title = st.text_input(
355
- "Topic Title",
356
- value=topic["topic_title"],
357
- key=f"topic_title_{i}",
358
- help="Enter the topic title"
359
- )
360
- st.session_state.topics_list[i]["topic_title"] = topic_title
361
-
362
- with col2:
363
- chapter_title = st.text_input(
364
- "Chapter Title",
365
- value=topic["chapter_title"],
366
- key=f"chapter_title_{i}",
367
- help="Enter the chapter title"
368
- )
369
- st.session_state.topics_list[i]["chapter_title"] = chapter_title
370
-
371
- with col3:
372
- if len(st.session_state.topics_list) > 1:
373
- st.markdown("<br>", unsafe_allow_html=True) # Add spacing
374
- if st.button("πŸ—‘οΈ", key=f"remove_{i}", help="Remove this topic"):
375
- st.session_state.topics_list.pop(i)
376
- st.rerun()
377
-
378
- st.markdown('</div>', unsafe_allow_html=True)
379
 
380
  # Language & Voice Settings Section
381
  st.markdown('<div class="section-header">πŸ—£οΈ Language & Voice Settings</div>', unsafe_allow_html=True)
@@ -413,12 +390,68 @@ with st.form("personalization_form", clear_on_submit=False):
413
 
414
  col1, col2 = st.columns(2)
415
  with col1:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
416
  programming_language = st.selectbox(
417
- "Programming Language",
418
- ["python", "java", "javascript", "c++", "go"],
419
- index=0,
420
- format_func=lambda x: x.capitalize(),
421
- help="Select the primary programming language for examples"
422
  )
423
  with col2:
424
  st.markdown("<br>", unsafe_allow_html=True) # Add spacing
@@ -430,30 +463,26 @@ with st.form("personalization_form", clear_on_submit=False):
430
  with col2:
431
  submitted = st.form_submit_button("πŸš€ Generate Base Course", use_container_width=True)
432
 
433
- # Add/Remove topic buttons outside the form (for multiple topics)
434
- if topic_mode == "Multiple Topics":
435
- st.markdown('<div class="action-buttons">', unsafe_allow_html=True)
436
- col1, col2, col3, col4 = st.columns([2, 2, 2, 4])
437
- with col1:
438
- if st.button("βž• Add Topic", key="add_topic", help="Add a new topic"):
439
- st.session_state.topics_list.append({
440
- "topic_title": f"Topic {len(st.session_state.topics_list) + 1}",
441
- "chapter_title": f"Chapter {len(st.session_state.topics_list) + 1}"
442
- })
443
- st.rerun()
444
- with col2:
445
- if st.button("πŸ”„ Reset All", key="reset_topics", help="Reset to default topics"):
446
- st.session_state.topics_list = [{"topic_title": "What is Flask", "chapter_title": "Introduction to Flask"}]
447
- st.rerun()
448
- st.markdown('</div>', unsafe_allow_html=True)
449
 
450
  # Handle submission
451
  if submitted:
452
- # Determine which topics to use based on mode
453
- if topic_mode == "Single Topic":
454
- topics_to_process = [{"topic_title": single_topic_title, "chapter_title": single_chapter_title}]
455
- else:
456
- topics_to_process = st.session_state.topics_list
457
 
458
  # Validate inputs
459
  valid_topics = []
@@ -575,7 +604,19 @@ if submitted:
575
  for i, session_id in enumerate(session_ids, 1):
576
  st.markdown(f'<div class="session-info">πŸ“ <strong>Session {i}:</strong> <code>{session_id}</code></div>', unsafe_allow_html=True)
577
 
 
 
 
 
 
578
 
 
 
 
 
 
 
 
579
 
580
  else:
581
  st.error(f"❌ API Error: {response.status_code}")
 
321
  # Topics Section
322
  st.markdown('<div class="section-header">πŸ“‹ Topics Configuration</div>', unsafe_allow_html=True)
323
 
324
+ # Display existing topics with better styling
325
+ for i, topic in enumerate(st.session_state.topics_list):
326
+ st.markdown(f'<div class="topic-container">', unsafe_allow_html=True)
327
+ st.markdown(f'<div class="topic-header">πŸ“– Topic {i+1}</div>', unsafe_allow_html=True)
 
 
 
 
 
 
 
328
 
329
+ col1, col2, col3 = st.columns([3, 3, 1])
330
  with col1:
331
+ topic_title = st.text_input(
332
+ "Topic Title",
333
+ value=topic["topic_title"],
334
+ key=f"topic_title_{i}",
335
+ help="Enter the topic title"
336
+ )
337
+ st.session_state.topics_list[i]["topic_title"] = topic_title
338
 
339
+ with col2:
340
+ chapter_title = st.text_input(
341
+ "Chapter Title",
342
+ value=topic["chapter_title"],
343
+ key=f"chapter_title_{i}",
344
+ help="Enter the chapter title"
345
+ )
346
+ st.session_state.topics_list[i]["chapter_title"] = chapter_title
347
 
348
+ with col3:
349
+ if len(st.session_state.topics_list) > 1:
350
+ st.markdown("<br>", unsafe_allow_html=True) # Add spacing
351
+ if st.button("πŸ—‘οΈ", key=f"remove_{i}", help="Remove this topic"):
352
+ st.session_state.topics_list.pop(i)
353
+ st.rerun()
354
 
355
+ st.markdown('</div>', unsafe_allow_html=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
356
 
357
  # Language & Voice Settings Section
358
  st.markdown('<div class="section-header">πŸ—£οΈ Language & Voice Settings</div>', unsafe_allow_html=True)
 
390
 
391
  col1, col2 = st.columns(2)
392
  with col1:
393
+ # Comprehensive list of programming languages, frameworks, and databases
394
+ tech_options = [
395
+ # Programming Languages
396
+ "Python", "Java", "JavaScript", "TypeScript", "C++", "C#", "C", "Go", "Rust", "Swift",
397
+ "Kotlin", "Scala", "Ruby", "PHP", "Perl", "R", "MATLAB", "Dart", "Objective-C", "Assembly",
398
+ "Haskell", "Erlang", "Elixir", "F#", "Clojure", "Lua", "Julia", "Groovy", "VB.NET", "COBOL",
399
+ "Fortran", "Pascal", "Delphi", "Ada", "Prolog", "Lisp", "Scheme", "OCaml", "ML",
400
+
401
+ # Web Technologies
402
+ "HTML", "CSS", "SASS", "LESS", "Bootstrap", "Tailwind CSS", "Material-UI",
403
+
404
+ # Frontend Frameworks/Libraries
405
+ "React", "Vue.js", "Angular", "Svelte", "Next.js", "Nuxt.js", "Gatsby", "Ember.js",
406
+ "Backbone.js", "jQuery", "Alpine.js", "Lit", "Stencil", "Ionic", "React Native",
407
+ "Flutter", "Xamarin", "Cordova", "PhoneGap",
408
+
409
+ # Backend Frameworks
410
+ "Node.js", "Express.js", "Nest.js", "Django", "Flask", "FastAPI", "Pyramid", "Tornado",
411
+ "Spring Boot", "Spring MVC", "Struts", "Hibernate", "ASP.NET", "ASP.NET Core",
412
+ "Ruby on Rails", "Sinatra", "Laravel", "Symfony", "CodeIgniter", "CakePHP", "Zend",
413
+ "Gin", "Echo", "Fiber", "Actix", "Rocket", "Warp", "Axum",
414
+
415
+ # Mobile Development
416
+ "Android (Java)", "Android (Kotlin)", "iOS (Swift)", "iOS (Objective-C)",
417
+
418
+ # Game Development
419
+ "Unity", "Unreal Engine", "Godot", "GameMaker Studio", "Construct", "Phaser",
420
+
421
+ # Database Technologies
422
+ "MySQL", "PostgreSQL", "SQLite", "Microsoft SQL Server", "Oracle Database",
423
+ "MongoDB", "Redis", "Cassandra", "DynamoDB", "Firebase", "Supabase",
424
+ "CouchDB", "Neo4j", "InfluxDB", "TimescaleDB", "ClickHouse", "Apache Spark",
425
+ "Elasticsearch", "Apache Solr", "Amazon RDS", "Google Cloud SQL",
426
+
427
+ # Cloud & DevOps
428
+ "AWS", "Google Cloud Platform", "Microsoft Azure", "Digital Ocean", "Heroku",
429
+ "Docker", "Kubernetes", "Terraform", "Ansible", "Jenkins", "GitLab CI", "GitHub Actions",
430
+ "Nginx", "Apache", "Linux", "Ubuntu", "CentOS", "Red Hat",
431
+
432
+ # Data Science & AI/ML
433
+ "TensorFlow", "PyTorch", "Scikit-learn", "Pandas", "NumPy", "Matplotlib", "Seaborn",
434
+ "Jupyter", "Apache Airflow", "Apache Kafka", "Apache Flink", "Hadoop", "Spark",
435
+ "Tableau", "Power BI", "D3.js", "Plotly", "OpenCV", "Keras", "XGBoost",
436
+
437
+ # Testing Frameworks
438
+ "Jest", "Mocha", "Chai", "Cypress", "Selenium", "Playwright", "Puppeteer",
439
+ "JUnit", "TestNG", "Mockito", "PyTest", "unittest", "RSpec", "PHPUnit",
440
+
441
+ # Other Technologies
442
+ "GraphQL", "REST API", "gRPC", "WebSocket", "Apache Kafka", "RabbitMQ",
443
+ "Blockchain", "Solidity", "Web3", "Ethereum", "Bitcoin", "Smart Contracts",
444
+ "Microservices", "Serverless", "Lambda Functions", "API Gateway"
445
+ ]
446
+
447
+ # Sort the options alphabetically
448
+ tech_options.sort()
449
+
450
  programming_language = st.selectbox(
451
+ "Programming Language / Technology",
452
+ tech_options,
453
+ index=tech_options.index("Python") if "Python" in tech_options else 0,
454
+ help="Select the primary programming language, framework, or technology for examples"
 
455
  )
456
  with col2:
457
  st.markdown("<br>", unsafe_allow_html=True) # Add spacing
 
463
  with col2:
464
  submitted = st.form_submit_button("πŸš€ Generate Base Course", use_container_width=True)
465
 
466
+ # Add/Remove topic buttons outside the form
467
+ st.markdown('<div class="action-buttons">', unsafe_allow_html=True)
468
+ col1, col2, col3, col4 = st.columns([2, 2, 2, 4])
469
+ with col1:
470
+ if st.button("βž• Add Topic", key="add_topic", help="Add a new topic"):
471
+ st.session_state.topics_list.append({
472
+ "topic_title": f"Topic {len(st.session_state.topics_list) + 1}",
473
+ "chapter_title": f"Chapter {len(st.session_state.topics_list) + 1}"
474
+ })
475
+ st.rerun()
476
+ with col2:
477
+ if st.button("πŸ”„ Reset All", key="reset_topics", help="Reset to default topics"):
478
+ st.session_state.topics_list = [{"topic_title": "What is Flask", "chapter_title": "Introduction to Flask"}]
479
+ st.rerun()
480
+ st.markdown('</div>', unsafe_allow_html=True)
 
481
 
482
  # Handle submission
483
  if submitted:
484
+ # Use the topics from session state directly
485
+ topics_to_process = st.session_state.topics_list
 
 
 
486
 
487
  # Validate inputs
488
  valid_topics = []
 
604
  for i, session_id in enumerate(session_ids, 1):
605
  st.markdown(f'<div class="session-info">πŸ“ <strong>Session {i}:</strong> <code>{session_id}</code></div>', unsafe_allow_html=True)
606
 
607
+ # Display API response
608
+ with st.expander("πŸ“Š View Full API Response", expanded=False):
609
+ st.markdown('<div class="api-response">', unsafe_allow_html=True)
610
+ st.json(response_data)
611
+ st.markdown('</div>', unsafe_allow_html=True)
612
 
613
+ # Information about tracking
614
+ st.info(f"""
615
+ πŸ’‘ **Tracking Information**
616
+ You can track the progress of your video generation using the session IDs above.
617
+ The processing status will be updated in DynamoDB table: `{SESSION_TABLE}`
618
+ Region: `{DYNAMODB_REGION}`
619
+ """)
620
 
621
  else:
622
  st.error(f"❌ API Error: {response.status_code}")