Skip to content

Adds Variable Checks #5

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
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ print(response)

### Output

{"output" : "The classifier considers the text to be very unlikely AI-generated.",
"Confidence score" : 96.15870427207666}
{'Class': 'very unlikely', 'AI-Generated Probability': 3.4583769381404563}

```

Expand Down Expand Up @@ -86,7 +85,7 @@ Here is an example
## TO-DO

- Add all classes labels (total 5 classes from openai) ✅
- add verifier to check if the sentence is 1000 characters long
- add verifier to check if the sentence is 1000 characters long
- automatically detect token from user_name, password


Expand Down
5 changes: 4 additions & 1 deletion detector/detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ def __init__(self, token):
self.class_max = [10, 45, 90, 98, 99]

def detect(self, text, all_probs=False):
if len(text) < 1000:
return "Check prompt, Length of sentence it should be more than 1,000 characters"
data = {
'prompt': text + "».\n<|disc_score|>",
'max_tokens': 1,
Expand Down Expand Up @@ -56,4 +58,5 @@ def detect(self, text, all_probs=False):
if all_probs:
return probs, top_prob
return top_prob
return "Check prompt, Length of sentence it should be more than 1,000 characters"
elif response.status_code != 200:
return "Web request was not successful. Please check your bearer token and try again."