Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -497,21 +497,21 @@ class JobPotral:
|
|
497 |
# Convert CSV file to a list of reviews
|
498 |
reviews = self.csv_to_list(file_path)
|
499 |
|
500 |
-
|
501 |
{"role": "system", "content": "You are a helpful assistant."},
|
502 |
-
{"role": "user", "content": f"
|
503 |
]
|
504 |
# Construct the prompt for OpenAI API
|
505 |
# Call OpenAI API with the given prompt
|
506 |
-
response = self.client.completions.create(
|
507 |
model="gpt-3.5-turbo", # You can use a different engine
|
508 |
-
messages=
|
509 |
max_tokens=200,
|
510 |
temperature = 0,
|
511 |
)
|
512 |
|
513 |
# Extract and return the generated text
|
514 |
-
self.answer += response.choices[0].
|
515 |
|
516 |
# Split the generated text into suggestion, positive, and negative reviews
|
517 |
suggestion_reviews = self.answer.split("Suggestion Reviews:")[1].split("Positive Reviews:")[0].strip()
|
|
|
497 |
# Convert CSV file to a list of reviews
|
498 |
reviews = self.csv_to_list(file_path)
|
499 |
|
500 |
+
prompt_template_ = [
|
501 |
{"role": "system", "content": "You are a helpful assistant."},
|
502 |
+
{"role": "user", "content": f"read and analyse to return suggestion reviews,postive reviews and negative reviews with label ***{reviews}***."}
|
503 |
]
|
504 |
# Construct the prompt for OpenAI API
|
505 |
# Call OpenAI API with the given prompt
|
506 |
+
response = self.client.chat.completions.create(
|
507 |
model="gpt-3.5-turbo", # You can use a different engine
|
508 |
+
messages=prompt_template_,
|
509 |
max_tokens=200,
|
510 |
temperature = 0,
|
511 |
)
|
512 |
|
513 |
# Extract and return the generated text
|
514 |
+
self.answer += response.choices[0].message.content
|
515 |
|
516 |
# Split the generated text into suggestion, positive, and negative reviews
|
517 |
suggestion_reviews = self.answer.split("Suggestion Reviews:")[1].split("Positive Reviews:")[0].strip()
|