diff --git a/README.md b/README.md index 0bda9c5..f797627 100644 --- a/README.md +++ b/README.md @@ -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} ``` @@ -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 diff --git a/detector/detector.py b/detector/detector.py index 0c6b2ed..ab1b697 100644 --- a/detector/detector.py +++ b/detector/detector.py @@ -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, @@ -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."