import openai
def classify_website(website):
prompt = "Website classification:\n\nWebsite: {} \nCategory:".format(website)
model_response = openai.Completion.create(
model="gpt-3.5-turbo",
prompt=prompt,
max_tokens=1,
temperature=0.2,
n=1,
stop=None,
temperature=0.2
)
category = model_response.choices[0].text.strip()
return category
def determine_piracy_type(website):
prompt = "Piracy type detection:\n\nWebsite: {} \nType:".format(website)
model_response = openai.Completion.create(
model="gpt-3.5-turbo",
prompt=prompt,
max_tokens=1,
temperature=0.2,
n=1,
stop=None,
temperature=0.2
)
piracy_type = model_response.choices[0].text.strip()
return piracy_type
Set up OpenAI API credentials
openai.api_key = "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"
Get website list input from the user
websites = input("Enter a comma-separated list of websites to classify: ").split(",")
Classify each website
for website in websites:
website = website.strip()
classification = classify_website(website)
if classification == "Piracy":
piracy_type = determine_piracy_type(website)
print("The website {} is classified as: Piracy - {}".format(website, piracy_type))
else:
print("The website {} is classified as: Legal".format(website))