From 8464c304b73e8e5521e09b02913ae27787819bd6 Mon Sep 17 00:00:00 2001 From: Philippe Vincent Date: Thu, 26 Oct 2023 17:54:13 -0400 Subject: [PATCH 1/2] feat(): WinstonAI --- edenai_apis/apis/winstonai/config.py | 4 +- .../outputs/text/ai_detection_output.json | 3 +- .../outputs/text/plagia_detection_output.json | 114 +++++++++++------- edenai_apis/apis/winstonai/winstonai_api.py | 12 +- 4 files changed, 79 insertions(+), 54 deletions(-) diff --git a/edenai_apis/apis/winstonai/config.py b/edenai_apis/apis/winstonai/config.py index 41cb697a..638561ac 100644 --- a/edenai_apis/apis/winstonai/config.py +++ b/edenai_apis/apis/winstonai/config.py @@ -1,3 +1 @@ -TOKEN_BEARER = "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImRkZ3NzdXRyaHpya2xsc3RnbGRiIiwicm9sZSI6ImFub24iLCJpYXQiOjE2ODY2ODc5MjMsImV4cCI6MjAwMjI2MzkyM30.bwSe1TrFMhcosgqFSlGIhMIv9fxohzLG0eyBEs7wUo8" - -WINSTON_AI_API_URL = "https://api.gowinston.ai/functions/v1" +WINSTON_AI_API_URL = "https://w7i3blp3r6.execute-api.us-east-1.amazonaws.com/v1" diff --git a/edenai_apis/apis/winstonai/outputs/text/ai_detection_output.json b/edenai_apis/apis/winstonai/outputs/text/ai_detection_output.json index 7448a7f6..cf7c17c0 100644 --- a/edenai_apis/apis/winstonai/outputs/text/ai_detection_output.json +++ b/edenai_apis/apis/winstonai/outputs/text/ai_detection_output.json @@ -28,8 +28,9 @@ "score": 0.01 } ], + "length": 2, "credits_used": 338, - "credits_remaining": 9981767 + "credits_remaining": 99999662 }, "standardized_response": { "ai_score": 0.01, diff --git a/edenai_apis/apis/winstonai/outputs/text/plagia_detection_output.json b/edenai_apis/apis/winstonai/outputs/text/plagia_detection_output.json index 8b51a74f..71cdec05 100644 --- a/edenai_apis/apis/winstonai/outputs/text/plagia_detection_output.json +++ b/edenai_apis/apis/winstonai/outputs/text/plagia_detection_output.json @@ -3,48 +3,58 @@ "status": 200, "results": [ { - "title": "API V1.0 Reference - Originality.ai API Documentation", + "title": "Rumored Samsung Gadgets For 2023: Galaxy Z Flip 5, Z Fold 5 and More - MSN", + "url": "https://www.msn.com/en-us/news/technology/rumored-samsung-gadgets-for-2023-galaxy-z-flip-5-z-fold-5-and-more/ar-AA16w9Ee", + "excerpts": [ + "Wearables have also become a large part of how Samsung intends to differentiate its phones from those of other Android device makers. It's a strategy to create a web of products that keep people hooked, much like Apple's range of devices." + ], + "date": "Jul 20, 2023" + }, + { + "title": "Originality.ai API Documentation", "url": "https://docs.originality.ai/api-v1-0-reference", "excerpts": [ "Should Samsung stick to its annual routine, we can expect to see new foldable phones and wearable devices in August. The company also previewed new designs for ...", - "... The company also previewed new designs for bendable phones and tablets earlier this year, hinting that the company may be planning to expand beyond the Z ...", - "... Though Samsung regularly releases new products across many categories, including TVs, home appliances and monitors, I'm most interested in where its mobile ...", + "\", \"cleanPhrase\": \"The company also previewed new designs for bendable phones and tablets earlier this year hinting that the company may be planning to ...", + "Though Samsung regularly releases new products across many categories, including TVs, home appliances and monitors, I'm most interested in where its mobile ...", "Wearables have also become a large part of how Samsung intends to differentiate its phones from those of other Android device makers. It's a strategy to create ...", "... It's a strategy to create a web of products that keep people hooked, much like Apple's range of devices.\", \"matches\": [ { \"website\": \"https://www.cnet.com ..." ] }, - { - "title": "The Biggest Rumored Samsung Gadgets to Expect in 2023 - YouTube", - "url": "https://www.youtube.com/watch?v=7DXADBWKlgA", - "excerpts": [ - "... Though Samsung regularly releases new products across many categories, including TVs, home appliances and monitors, I'm most interested in where its mobile ...", - "... influence than most other tech companies on the devices we carry in our pockets each day. Wearables have also become a large part of how Samsung intends to ...", - "... It's a strategy to create a web of products that keep people hooked, much like Apple's range of devices. Here are the rumored Samsung products I'm most ..." - ] - }, { "title": "Rumored Samsung Gadgets For 2023: Galaxy Z Flip 5, Z Fold 5 and More - CNET", "url": "https://www.cnet.com/tech/mobile/galaxy-s23-z-fold-5-and-more-samsung-gadgets-rumored-for-2023/", "excerpts": [ "... Though Samsung regularly releases new products across many categories, including TVs, home appliances and monitors, I'm most interested in ...", + "Wearables have also become a large part of how Samsung intends to differentiate its phones from those of other Android device makers. It's a ...", "Wearables have also become a large part of how Samsung intends to differentiate its phones from those of other Android device makers. It's a strategy to create a web of products that keep people hooked, much like Apple's range of devices." ], "date": "Jul 20, 2023" }, { - "title": "Samsung products website", - "url": "https://jaxbl.bgbulbs.com/samsung-products-website/67820286", + "title": "The Biggest Rumored Samsung Gadgets to Expect in 2023 - YouTube", + "url": "https://www.youtube.com/watch?v=7DXADBWKlgA", "excerpts": [ - "... influence than most other tech companies on the devices we carry in our pockets each day. recession breathing children unleashed rescue WebSamsung helps you ..." + "... Though Samsung regularly releases new products across many categories, including TVs, home appliances and monitors, I'm most interested in where its mobile ...", + "... influence than most other tech companies on the devices we carry in our pockets each day. Wearables have also become a large part of how Samsung intends to ...", + "... It's a strategy to create a web of products that keep people hooked, much like Apple's range of devices. Here are the rumored Samsung products I'm most ..." ] }, { - "title": "Rumored Samsung Gadgets I Want to See in 2023 - Knowledia News", - "url": "https://news.knowledia.com/US/en/articles/rumored-samsung-gadgets-i-want-to-see-in-2023-2e8a69ee70b65eaf1f08135770d3d7e21367c8ba", + "title": "Galaxy Z Fold 5 and Other Samsung Gadgets to Look for in 2023 IT ...", + "url": "https://www.rbsitsoftwaresolution.com/blog/galaxy-z-fold-5-and-other-samsung-gadgets-to-look-for-in-2023.html", "excerpts": [ - "... influence than most other tech companies on the devices we carry in our pockets each day. Wearables have also become a large part of how Samsung intends to ..." + "... the company may be planning to expand beyond the Z Fold and Z Flip in the near future. Though Samsung regularly releases new products across many categories ..." ] }, + { + "title": "Galaxy Z Fold 5 and Other Samsung Gadgets to Look for in 2023", + "url": "https://www.umaconferences.com/galaxy-z-fold-5-and-other-samsung-gadgets-to-look-for-in-2023/", + "excerpts": [ + "... The Galaxy S23 launch may be far behind us, but Samsung likely has plenty more to announce in 2023. That's if history repeats itself. Should ..." + ], + "date": "May 24, 2023" + }, { "title": "Galaxy S23, Z Fold 5 and more Samsung gadgets rumored for 2023 - US Today News", "url": "https://ustoday.news/galaxy-s23-z-fold-5-and-more-samsung-gadgets-rumored-for-2023/", @@ -54,17 +64,29 @@ "date": "Jan 24, 2023" } ], - "results_count": 6, + "results_count": 7, "errors": [], "errors_count": 0, - "credits_used": 176, - "credits_remaining": 9982105 + "score": 100, + "credits_used": 352, + "credits_remaining": 99999648 }, "standardized_response": { - "plagia_score": 6.0, + "plagia_score": 100.0, "items": [ { - "text": "API V1.0 Reference - Originality.ai API Documentation", + "text": "Rumored Samsung Gadgets For 2023: Galaxy Z Flip 5, Z Fold 5 and More - MSN", + "candidates": [ + { + "url": "https://www.msn.com/en-us/news/technology/rumored-samsung-gadgets-for-2023-galaxy-z-flip-5-z-fold-5-and-more/ar-AA16w9Ee", + "plagia_score": 1.0, + "prediction": "plagiarized", + "plagiarized_text": "Wearables have also become a large part of how Samsung intends to differentiate its phones from those of other Android device makers. It's a strategy to create a web of products that keep people hooked, much like Apple's range of devices." + } + ] + }, + { + "text": "Originality.ai API Documentation", "candidates": [ { "url": "https://docs.originality.ai/api-v1-0-reference", @@ -76,13 +98,13 @@ "url": "https://docs.originality.ai/api-v1-0-reference", "plagia_score": 1.0, "prediction": "plagiarized", - "plagiarized_text": "... The company also previewed new designs for bendable phones and tablets earlier this year, hinting that the company may be planning to expand beyond the Z ..." + "plagiarized_text": "\", \"cleanPhrase\": \"The company also previewed new designs for bendable phones and tablets earlier this year hinting that the company may be planning to ..." }, { "url": "https://docs.originality.ai/api-v1-0-reference", "plagia_score": 1.0, "prediction": "plagiarized", - "plagiarized_text": "... Though Samsung regularly releases new products across many categories, including TVs, home appliances and monitors, I'm most interested in where its mobile ..." + "plagiarized_text": "Though Samsung regularly releases new products across many categories, including TVs, home appliances and monitors, I'm most interested in where its mobile ..." }, { "url": "https://docs.originality.ai/api-v1-0-reference", @@ -99,64 +121,70 @@ ] }, { - "text": "The Biggest Rumored Samsung Gadgets to Expect in 2023 - YouTube", + "text": "Rumored Samsung Gadgets For 2023: Galaxy Z Flip 5, Z Fold 5 and More - CNET", "candidates": [ { - "url": "https://www.youtube.com/watch?v=7DXADBWKlgA", + "url": "https://www.cnet.com/tech/mobile/galaxy-s23-z-fold-5-and-more-samsung-gadgets-rumored-for-2023/", "plagia_score": 1.0, "prediction": "plagiarized", - "plagiarized_text": "... Though Samsung regularly releases new products across many categories, including TVs, home appliances and monitors, I'm most interested in where its mobile ..." + "plagiarized_text": "... Though Samsung regularly releases new products across many categories, including TVs, home appliances and monitors, I'm most interested in ..." }, { - "url": "https://www.youtube.com/watch?v=7DXADBWKlgA", + "url": "https://www.cnet.com/tech/mobile/galaxy-s23-z-fold-5-and-more-samsung-gadgets-rumored-for-2023/", "plagia_score": 1.0, "prediction": "plagiarized", - "plagiarized_text": "... influence than most other tech companies on the devices we carry in our pockets each day. Wearables have also become a large part of how Samsung intends to ..." + "plagiarized_text": "Wearables have also become a large part of how Samsung intends to differentiate its phones from those of other Android device makers. It's a ..." }, { - "url": "https://www.youtube.com/watch?v=7DXADBWKlgA", + "url": "https://www.cnet.com/tech/mobile/galaxy-s23-z-fold-5-and-more-samsung-gadgets-rumored-for-2023/", "plagia_score": 1.0, "prediction": "plagiarized", - "plagiarized_text": "... It's a strategy to create a web of products that keep people hooked, much like Apple's range of devices. Here are the rumored Samsung products I'm most ..." + "plagiarized_text": "Wearables have also become a large part of how Samsung intends to differentiate its phones from those of other Android device makers. It's a strategy to create a web of products that keep people hooked, much like Apple's range of devices." } ] }, { - "text": "Rumored Samsung Gadgets For 2023: Galaxy Z Flip 5, Z Fold 5 and More - CNET", + "text": "The Biggest Rumored Samsung Gadgets to Expect in 2023 - YouTube", "candidates": [ { - "url": "https://www.cnet.com/tech/mobile/galaxy-s23-z-fold-5-and-more-samsung-gadgets-rumored-for-2023/", + "url": "https://www.youtube.com/watch?v=7DXADBWKlgA", "plagia_score": 1.0, "prediction": "plagiarized", - "plagiarized_text": "... Though Samsung regularly releases new products across many categories, including TVs, home appliances and monitors, I'm most interested in ..." + "plagiarized_text": "... Though Samsung regularly releases new products across many categories, including TVs, home appliances and monitors, I'm most interested in where its mobile ..." }, { - "url": "https://www.cnet.com/tech/mobile/galaxy-s23-z-fold-5-and-more-samsung-gadgets-rumored-for-2023/", + "url": "https://www.youtube.com/watch?v=7DXADBWKlgA", "plagia_score": 1.0, "prediction": "plagiarized", - "plagiarized_text": "Wearables have also become a large part of how Samsung intends to differentiate its phones from those of other Android device makers. It's a strategy to create a web of products that keep people hooked, much like Apple's range of devices." + "plagiarized_text": "... influence than most other tech companies on the devices we carry in our pockets each day. Wearables have also become a large part of how Samsung intends to ..." + }, + { + "url": "https://www.youtube.com/watch?v=7DXADBWKlgA", + "plagia_score": 1.0, + "prediction": "plagiarized", + "plagiarized_text": "... It's a strategy to create a web of products that keep people hooked, much like Apple's range of devices. Here are the rumored Samsung products I'm most ..." } ] }, { - "text": "Samsung products website", + "text": "Galaxy Z Fold 5 and Other Samsung Gadgets to Look for in 2023 IT ...", "candidates": [ { - "url": "https://jaxbl.bgbulbs.com/samsung-products-website/67820286", + "url": "https://www.rbsitsoftwaresolution.com/blog/galaxy-z-fold-5-and-other-samsung-gadgets-to-look-for-in-2023.html", "plagia_score": 1.0, "prediction": "plagiarized", - "plagiarized_text": "... influence than most other tech companies on the devices we carry in our pockets each day. recession breathing children unleashed rescue WebSamsung helps you ..." + "plagiarized_text": "... the company may be planning to expand beyond the Z Fold and Z Flip in the near future. Though Samsung regularly releases new products across many categories ..." } ] }, { - "text": "Rumored Samsung Gadgets I Want to See in 2023 - Knowledia News", + "text": "Galaxy Z Fold 5 and Other Samsung Gadgets to Look for in 2023", "candidates": [ { - "url": "https://news.knowledia.com/US/en/articles/rumored-samsung-gadgets-i-want-to-see-in-2023-2e8a69ee70b65eaf1f08135770d3d7e21367c8ba", + "url": "https://www.umaconferences.com/galaxy-z-fold-5-and-other-samsung-gadgets-to-look-for-in-2023/", "plagia_score": 1.0, "prediction": "plagiarized", - "plagiarized_text": "... influence than most other tech companies on the devices we carry in our pockets each day. Wearables have also become a large part of how Samsung intends to ..." + "plagiarized_text": "... The Galaxy S23 launch may be far behind us, but Samsung likely has plenty more to announce in 2023. That's if history repeats itself. Should ..." } ] }, diff --git a/edenai_apis/apis/winstonai/winstonai_api.py b/edenai_apis/apis/winstonai/winstonai_api.py index e5f41cd6..ce34c2ae 100644 --- a/edenai_apis/apis/winstonai/winstonai_api.py +++ b/edenai_apis/apis/winstonai/winstonai_api.py @@ -10,7 +10,7 @@ import requests import json from edenai_apis.utils.exception import ProviderException -from edenai_apis.apis.winstonai.config import TOKEN_BEARER, WINSTON_AI_API_URL +from edenai_apis.apis.winstonai.config import WINSTON_AI_API_URL from edenai_apis.features.text.plagia_detection.plagia_detection_dataclass import ( PlagiaDetectionCandidate, PlagiaDetectionDataClass, @@ -25,16 +25,14 @@ def __init__(self, api_keys: Dict = {}): self.api_settings = load_provider( ProviderDataEnum.KEY, provider_name=self.provider_name, api_keys=api_keys ) - self.api_key = self.api_settings["api_key"] - self.bearer_token = TOKEN_BEARER self.api_url = WINSTON_AI_API_URL self.headers = { "Content-Type": "application/json", - "Authorization": self.bearer_token, + "Authorization": f'Bearer {self.api_settings["api_key"]}', } def text__ai_detection(self, text: str) -> ResponseType[AiDetectionDataClass]: - payload = json.dumps({"api_key": self.api_key, "text": text, "sentences": True}) + payload = json.dumps({ "text": text, "sentences": True }) response = requests.request( "POST", f"{self.api_url}/predict", headers=self.headers, data=payload @@ -69,7 +67,7 @@ def text__ai_detection(self, text: str) -> ResponseType[AiDetectionDataClass]: def text__plagia_detection( self, text: str, title: str = "" ) -> ResponseType[PlagiaDetectionDataClass]: - payload = json.dumps({"api_key": self.api_key, "text": text}) + payload = json.dumps({ "text": text }) response = requests.request( "POST", f"{self.api_url}/plagiarism", headers=self.headers, data=payload @@ -85,7 +83,7 @@ def text__plagia_detection( raise ProviderException(response.json()) standardized_response = PlagiaDetectionDataClass( - plagia_score=original_response["results_count"], + plagia_score=original_response["score"], items=[ PlagiaDetectionItem( text=result["title"], From db9a2aa578a224a6a4a04723d107505722206a8b Mon Sep 17 00:00:00 2001 From: Philippe Vincent Date: Tue, 31 Oct 2023 16:03:03 -0400 Subject: [PATCH 2/2] feat(): AI_DETECTION --- edenai_apis/apis/winstonai/config.py | 2 +- edenai_apis/apis/winstonai/info.json | 7 ++-- .../outputs/text/ai_detection_output.json | 12 +++---- .../outputs/text/plagia_detection_output.json | 32 +++++++++---------- edenai_apis/apis/winstonai/winstonai_api.py | 2 +- .../ai_detection/ai_detection_dataclass.py | 7 ++++ 6 files changed, 35 insertions(+), 27 deletions(-) diff --git a/edenai_apis/apis/winstonai/config.py b/edenai_apis/apis/winstonai/config.py index 638561ac..3cde3e5e 100644 --- a/edenai_apis/apis/winstonai/config.py +++ b/edenai_apis/apis/winstonai/config.py @@ -1 +1 @@ -WINSTON_AI_API_URL = "https://w7i3blp3r6.execute-api.us-east-1.amazonaws.com/v1" +WINSTON_AI_API_URL = "https://api.gowinston.ai/functions/v1" diff --git a/edenai_apis/apis/winstonai/info.json b/edenai_apis/apis/winstonai/info.json index 1af7035c..7ea1803c 100644 --- a/edenai_apis/apis/winstonai/info.json +++ b/edenai_apis/apis/winstonai/info.json @@ -1,18 +1,19 @@ { "text": { "ai_detection":{ - "version" : "v1", + "version" : "v2", "constraints": { "languages": [ "en", "fr", "es", - "de" + "de", + "pt" ] } }, "plagia_detection":{ - "version" : "v1" + "version" : "v2" } } } \ No newline at end of file diff --git a/edenai_apis/apis/winstonai/outputs/text/ai_detection_output.json b/edenai_apis/apis/winstonai/outputs/text/ai_detection_output.json index cf7c17c0..40c3f331 100644 --- a/edenai_apis/apis/winstonai/outputs/text/ai_detection_output.json +++ b/edenai_apis/apis/winstonai/outputs/text/ai_detection_output.json @@ -37,32 +37,32 @@ "items": [ { "text": "The panther, also known as the black panther, is a magnificent and enigmatic creature that captivates the imagination of many. It is not a distinct species itself, but rather a melanistic variant of leopards and jaguars. The mesmerizing black coat of the panther is a result of a genetic mutation that increases the production of dark pigment, melanin.", - "prediction": "original", + "prediction": "ai-generated", "ai_score": 0.32 }, { "text": "Panthers are highly adaptable predators, found primarily in dense forests and jungles across Africa, Asia, and the Americas. Their stealthy nature and exceptional agility make them formidable hunters. They are solitary creatures, preferring to roam alone in their vast territories, which can span over a hundred square miles.", - "prediction": "original", + "prediction": "ai-generated", "ai_score": 0.03 }, { "text": "Equipped with incredible strength and sharp retractable claws, panthers are skilled climbers and swimmers. Their keen senses, including sharp vision and acute hearing, aid them in locating prey, often stalking their victims from the cover of trees or thick underbrush before launching a precise and powerful attack. The diet of a panther consists mainly of deer, wild boar, and smaller mammals.", - "prediction": "original", + "prediction": "ai-generated", "ai_score": 0.02 }, { "text": "However, they are opportunistic hunters and can also target livestock and domestic animals in areas where their habitats overlap with human settlements. Unfortunately, this sometimes leads to conflicts with humans, resulting in the panther being perceived as a threat.", - "prediction": "original", + "prediction": "ai-generated", "ai_score": 0.06 }, { "text": "Despite their association with darkness and mystery, panthers play a vital role in maintaining the balance of ecosystems. As apex predators, they help control populations of herbivores, preventing overgrazing and maintaining healthy prey dynamics. Conservation efforts are crucial to the survival of panther populations worldwide.", - "prediction": "original", + "prediction": "ai-generated", "ai_score": 0.01 }, { "text": "Habitat loss, poaching, and illegal wildlife trade pose significant threats to their existence. Various organizations and governments are working tirelessly to protect these magnificent creatures through initiatives such as establishing protected areas, promoting sustainable land use practices, and raising awareness about their importance in the natural world.", - "prediction": "original", + "prediction": "ai-generated", "ai_score": 0.01 } ] diff --git a/edenai_apis/apis/winstonai/outputs/text/plagia_detection_output.json b/edenai_apis/apis/winstonai/outputs/text/plagia_detection_output.json index 71cdec05..e9b746a1 100644 --- a/edenai_apis/apis/winstonai/outputs/text/plagia_detection_output.json +++ b/edenai_apis/apis/winstonai/outputs/text/plagia_detection_output.json @@ -15,7 +15,7 @@ "url": "https://docs.originality.ai/api-v1-0-reference", "excerpts": [ "Should Samsung stick to its annual routine, we can expect to see new foldable phones and wearable devices in August. The company also previewed new designs for ...", - "\", \"cleanPhrase\": \"The company also previewed new designs for bendable phones and tablets earlier this year hinting that the company may be planning to ...", + "... The company also previewed new designs for bendable phones and tablets earlier this year, hinting that the company may be planning to expand beyond the Z ...", "Though Samsung regularly releases new products across many categories, including TVs, home appliances and monitors, I'm most interested in where its mobile ...", "Wearables have also become a large part of how Samsung intends to differentiate its phones from those of other Android device makers. It's a strategy to create ...", "... It's a strategy to create a web of products that keep people hooked, much like Apple's range of devices.\", \"matches\": [ { \"website\": \"https://www.cnet.com ..." @@ -47,14 +47,6 @@ "... the company may be planning to expand beyond the Z Fold and Z Flip in the near future. Though Samsung regularly releases new products across many categories ..." ] }, - { - "title": "Galaxy Z Fold 5 and Other Samsung Gadgets to Look for in 2023", - "url": "https://www.umaconferences.com/galaxy-z-fold-5-and-other-samsung-gadgets-to-look-for-in-2023/", - "excerpts": [ - "... The Galaxy S23 launch may be far behind us, but Samsung likely has plenty more to announce in 2023. That's if history repeats itself. Should ..." - ], - "date": "May 24, 2023" - }, { "title": "Galaxy S23, Z Fold 5 and more Samsung gadgets rumored for 2023 - US Today News", "url": "https://ustoday.news/galaxy-s23-z-fold-5-and-more-samsung-gadgets-rumored-for-2023/", @@ -62,6 +54,14 @@ "... the company may be planning to expand beyond the Z Fold and Z Flip in the near future. Although Samsung regularly releases new products in ..." ], "date": "Jan 24, 2023" + }, + { + "title": "Galaxy Z Fold 5 and Other Samsung Gadgets to Look for in 2023", + "url": "https://www.umaconferences.com/galaxy-z-fold-5-and-other-samsung-gadgets-to-look-for-in-2023/", + "excerpts": [ + "The Galaxy S23 launch may be far behind us, but Samsung likely has plenty more to announce in 2023. That's if history repeats itself." + ], + "date": "May 24, 2023" } ], "results_count": 7, @@ -98,7 +98,7 @@ "url": "https://docs.originality.ai/api-v1-0-reference", "plagia_score": 1.0, "prediction": "plagiarized", - "plagiarized_text": "\", \"cleanPhrase\": \"The company also previewed new designs for bendable phones and tablets earlier this year hinting that the company may be planning to ..." + "plagiarized_text": "... The company also previewed new designs for bendable phones and tablets earlier this year, hinting that the company may be planning to expand beyond the Z ..." }, { "url": "https://docs.originality.ai/api-v1-0-reference", @@ -178,24 +178,24 @@ ] }, { - "text": "Galaxy Z Fold 5 and Other Samsung Gadgets to Look for in 2023", + "text": "Galaxy S23, Z Fold 5 and more Samsung gadgets rumored for 2023 - US Today News", "candidates": [ { - "url": "https://www.umaconferences.com/galaxy-z-fold-5-and-other-samsung-gadgets-to-look-for-in-2023/", + "url": "https://ustoday.news/galaxy-s23-z-fold-5-and-more-samsung-gadgets-rumored-for-2023/", "plagia_score": 1.0, "prediction": "plagiarized", - "plagiarized_text": "... The Galaxy S23 launch may be far behind us, but Samsung likely has plenty more to announce in 2023. That's if history repeats itself. Should ..." + "plagiarized_text": "... the company may be planning to expand beyond the Z Fold and Z Flip in the near future. Although Samsung regularly releases new products in ..." } ] }, { - "text": "Galaxy S23, Z Fold 5 and more Samsung gadgets rumored for 2023 - US Today News", + "text": "Galaxy Z Fold 5 and Other Samsung Gadgets to Look for in 2023", "candidates": [ { - "url": "https://ustoday.news/galaxy-s23-z-fold-5-and-more-samsung-gadgets-rumored-for-2023/", + "url": "https://www.umaconferences.com/galaxy-z-fold-5-and-other-samsung-gadgets-to-look-for-in-2023/", "plagia_score": 1.0, "prediction": "plagiarized", - "plagiarized_text": "... the company may be planning to expand beyond the Z Fold and Z Flip in the near future. Although Samsung regularly releases new products in ..." + "plagiarized_text": "The Galaxy S23 launch may be far behind us, but Samsung likely has plenty more to announce in 2023. That's if history repeats itself." } ] } diff --git a/edenai_apis/apis/winstonai/winstonai_api.py b/edenai_apis/apis/winstonai/winstonai_api.py index ce34c2ae..ea6cae45 100644 --- a/edenai_apis/apis/winstonai/winstonai_api.py +++ b/edenai_apis/apis/winstonai/winstonai_api.py @@ -52,7 +52,7 @@ def text__ai_detection(self, text: str) -> ResponseType[AiDetectionDataClass]: AiDetectionItem( text=sentence["text"], ai_score=sentence["score"], - prediction=AiDetectionItem.set_label_based_on_score(sentence["score"]), + prediction=AiDetectionItem.set_label_based_on_human_score(sentence["score"]), ) for sentence in sentences ] diff --git a/edenai_apis/features/text/ai_detection/ai_detection_dataclass.py b/edenai_apis/features/text/ai_detection/ai_detection_dataclass.py index ce2946a1..ec738a15 100644 --- a/edenai_apis/features/text/ai_detection/ai_detection_dataclass.py +++ b/edenai_apis/features/text/ai_detection/ai_detection_dataclass.py @@ -19,6 +19,13 @@ def check_min_max(cls, v): if not 0 <= v <= 1: raise ValueError("Value should be between 0 and 1") return v + + @staticmethod + def set_label_based_on_human_score(human_score: float): + if human_score > 0.5: + return "original" + else: + return "ai-generated" class AiDetectionDataClass(BaseModel):