-
-
Notifications
You must be signed in to change notification settings - Fork 418
Complete UI Redesign with Landing Page and Interactive Quiz Mode #499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Prateekiiitg56
wants to merge
10
commits into
AOSSIE-Org:main
Choose a base branch
from
Prateekiiitg56:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
79aff4b
feat: full UI/UX redesign + new pages and backend fixes
Prateekiiitg56 a50709f
added
Prateekiiitg56 c87aa51
Merge branch 'AOSSIE-Org:main' into main
Prateekiiitg56 ee39228
Update eduaid_web/src/pages/InteractiveQuiz.jsx
Prateekiiitg56 d8ba321
feat: add landing page and interactive quiz
Prateekiiitg56 df0e009
fix: security hardening, code cleanup & unused import removal
Prateekiiitg56 78bf5a7
fix: address code review findings - deduplicate NLTK helper, fix bugs…
Prateekiiitg56 7f505d2
fix: BOM removal, spacy caching, CORS env config, a11y & HTML validit…
Prateekiiitg56 cf21ec1
fix: a11y mobile menu, isActive routing, subtitle concurrency, boolq-…
Prateekiiitg56 2246502
fix: boolq_hard invalid answer_style, boolean answer payload shape, m…
Prateekiiitg56 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| """Shared NLTK utility to avoid duplicating _safe_nltk_download across modules.""" | ||
| import logging | ||
| import nltk | ||
|
|
||
| logger = logging.getLogger(__name__) | ||
|
|
||
|
|
||
| def safe_nltk_download(pkg): | ||
| """Download an NLTK resource if not already present, logging failures.""" | ||
| try: | ||
| nltk.data.find(pkg) | ||
| except LookupError: | ||
| try: | ||
| success = nltk.download(pkg.split('/')[-1], quiet=True, raise_on_error=False) | ||
| if not success: | ||
| logger.warning("NLTK resource '%s' download returned False — resource may be unavailable", pkg) | ||
| except Exception as e: | ||
| logger.warning("Failed to download NLTK resource '%s': %s", pkg, e) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| """ | ||
| Pre-download all required HuggingFace models to local cache. | ||
| Run this once before starting the server. | ||
| """ | ||
| import os | ||
|
|
||
| # Use platform-agnostic cache directory (override with HF_HOME env var) | ||
| _default_cache = os.path.join(os.path.expanduser('~'), '.cache', 'huggingface') | ||
| HF_CACHE_DIR = os.environ.get('HF_HOME', _default_cache) | ||
| os.environ['HF_HOME'] = HF_CACHE_DIR | ||
| os.environ['TRANSFORMERS_CACHE'] = os.path.join(HF_CACHE_DIR, 'transformers') | ||
|
|
||
| print(f"Downloading models to {HF_CACHE_DIR} ...") | ||
| print("This may take 10-30 minutes depending on your internet speed.\n") | ||
|
|
||
| from transformers import ( | ||
| T5ForConditionalGeneration, T5Tokenizer, | ||
| AutoModelForSequenceClassification, AutoTokenizer, | ||
| AutoModelForSeq2SeqLM | ||
| ) | ||
|
|
||
| models = [ | ||
| ('T5Tokenizer', 't5-large'), | ||
| ('T5ForConditionalGeneration', 'Roasters/Question-Generator'), | ||
| ('T5Tokenizer', 't5-base'), | ||
| ('T5ForConditionalGeneration', 'Roasters/Boolean-Questions'), | ||
| ('T5ForConditionalGeneration', 'Roasters/Answer-Predictor'), | ||
| ] | ||
|
|
||
| for model_type, model_name in models: | ||
| print(f" Downloading {model_name} ...") | ||
| try: | ||
| if model_type == 'T5Tokenizer': | ||
| T5Tokenizer.from_pretrained(model_name) | ||
| elif model_type == 'T5ForConditionalGeneration': | ||
| T5ForConditionalGeneration.from_pretrained(model_name) | ||
| print(f" ✓ {model_name} done\n") | ||
| except Exception as e: | ||
| print(f" ✗ {model_name} failed: {e}\n") | ||
|
|
||
| # Also check for QG and QAE models used in QuestionGenerator / AnswerPredictor | ||
| import re | ||
| try: | ||
| with open(os.path.join(os.path.dirname(__file__), 'Generator', 'main.py')) as f: | ||
| content = f.read() | ||
| # Find QG_PRETRAINED and QAE_PRETRAINED values | ||
| qg = re.search(r"QG_PRETRAINED\s*=\s*['\"]([^'\"]+)['\"]", content) | ||
| qae = re.search(r"QAE_PRETRAINED\s*=\s*['\"]([^'\"]+)['\"]", content) | ||
| nli = re.search(r"nli_model_name\s*=\s*['\"]([^'\"]+)['\"]", content) | ||
|
|
||
| for match, label in [(qg, 'QG'), (qae, 'QAE'), (nli, 'NLI')]: | ||
| if match: | ||
| name = match.group(1) | ||
| print(f" Downloading {label} model: {name} ...") | ||
| try: | ||
| AutoTokenizer.from_pretrained(name, use_fast=False) | ||
| AutoModelForSeq2SeqLM.from_pretrained(name) | ||
| print(f" ✓ {label} done\n") | ||
| except Exception as e: | ||
| try: | ||
| AutoModelForSequenceClassification.from_pretrained(name) | ||
| print(f" ✓ {label} done\n") | ||
| except Exception as e2: | ||
| print(f" ✗ {label} failed: {e2}\n") | ||
Prateekiiitg56 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| except Exception as e: | ||
| print(f"Could not parse main.py for additional models: {e}") | ||
|
|
||
| print("\nAll downloads complete! You can now start server.py") | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.