Skip to content

Instantly share code, notes, and snippets.

@onyedikachi-david
Created May 31, 2023 18:21
Show Gist options
  • Save onyedikachi-david/3f5fa4f98fc470d1dbac7e932a5c62e3 to your computer and use it in GitHub Desktop.
Save onyedikachi-david/3f5fa4f98fc470d1dbac7e932a5c62e3 to your computer and use it in GitHub Desktop.
import requests
from flask import Flask
def confidenceToPercent(original, plagiarism):
return (plagiarism / (original + plagiarism)) * 100
def grading(original, plagiarism):
result = confidenceToPercent(original, plagiarism)
return result
app = Flask(__name__)
response = requests.post(
"https://jpwahle-plagiarism-detection.hf.space/run/predict",
json={
"data": [
"The North Pacific right whale seems to happen in two populaces. The populace in the eastern North Pacific/Bering Sea is amazingly low, numbering around 30 people. A bigger western populace of 100– 200 seems, by all accounts, to be making due in the Sea of Okhotsk, yet next to no is thought about this populace. In this manner, the two northern right whale species are the most jeopardized of every extensive whale and two of the most imperiled creature species on the planet. In light of current populace thickness patterns, the two species are anticipated to end up wiped out inside 200 years. The Pacific species was truly found in summer from the Sea of Okhotsk in the west to the Gulf of Alaska in the east, for the most part north of 50°N. Today, sightings are exceptionally uncommon and for the most part happen in the mouth of the Sea of Okhotsk and in the eastern Bering Sea. In spite of the fact that this species is all around prone to be transitory like the other two species, its development designs are not known."
]
},
).json()
data = response["data"]
original_confidence = data[0]["confidences"][0]["confidence"]
plagiarism_confidence = data[0]["confidences"][1]["confidence"]
value = grading(original_confidence, plagiarism_confidence)
print(data)
print(f"Plagiarism confidence: {plagiarism_confidence}%")
print(f"Originality confidence: {original_confidence}%")
print(f"Percentage of confidence: {value}%")
@app.route("/")
def main():
return str(data)
if __name__ == "__main__":
app.run()
@QuintD
Copy link

QuintD commented Jun 2, 2023

You are yet to upload the update we made today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment