Spaces:
Sleeping
Sleeping
Download src/complexity_score.py from NavyaNayer/Moodify-Task: direct link, hf CLI and curl.
- Browser
- Download file 1.42 kB
-
https://huggingface.co/spaces/NavyaNayer/Moodify-Task/resolve/main/src/complexity_score.py
- Command line
-
hf download hf://spaces/NavyaNayer/Moodify-Task/src/complexity_score.py
-
curl -L -o complexity_score.py https://huggingface.co/spaces/NavyaNayer/Moodify-Task/resolve/main/src/complexity_score.py
1.42 kB
| <<<<<<< HEAD | |
| from transformers import AutoTokenizer, AutoModelForSequenceClassification | |
| import torch | |
| # Load the tokenizer and model | |
| tokenizer = AutoTokenizer.from_pretrained("thethinkmachine/Maxwell-Task-Complexity-Scorer-v0.2") | |
| model = AutoModelForSequenceClassification.from_pretrained("thethinkmachine/Maxwell-Task-Complexity-Scorer-v0.2") | |
| # Example task | |
| task_description = "find a new theory" | |
| # Tokenize the input | |
| inputs = tokenizer(task_description, return_tensors="pt") | |
| # Perform inference | |
| with torch.no_grad(): | |
| outputs = model(**inputs) | |
| complexity_score = torch.sigmoid(outputs.logits).item() | |
| print(f"Task Complexity Score: {complexity_score:.4f}") | |
| ======= | |
| from transformers import AutoTokenizer, AutoModelForSequenceClassification | |
| import torch | |
| # Load the tokenizer and model | |
| tokenizer = AutoTokenizer.from_pretrained("thethinkmachine/Maxwell-Task-Complexity-Scorer-v0.2") | |
| model = AutoModelForSequenceClassification.from_pretrained("thethinkmachine/Maxwell-Task-Complexity-Scorer-v0.2") | |
| # Example task | |
| task_description = "find a new theory" | |
| # Tokenize the input | |
| inputs = tokenizer(task_description, return_tensors="pt") | |
| # Perform inference | |
| with torch.no_grad(): | |
| outputs = model(**inputs) | |
| complexity_score = torch.sigmoid(outputs.logits).item() | |
| print(f"Task Complexity Score: {complexity_score:.4f}") | |
| >>>>>>> b1313c5d084e410cadf261f2fafd8929cb149a4f | |