Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -50,10 +50,10 @@ def call_openai_api(persona, user_prompt):
|
|
50 |
response = openai.ChatCompletion.create(
|
51 |
model="gpt-3.5-turbo",
|
52 |
messages=[
|
53 |
-
{"role": "system", "content": "You are {persona}"},
|
54 |
-
{"role": "user", "content": f"Ignore all previous instructions. As a Cognitive AI Agent your persona is:{persona}
|
55 |
You will answer only as an expert in cognitive workplace and Humancentric leadership.
|
56 |
-
All answers must relate to HumanCentric services or cognitive workplace. {user_prompt}"},
|
57 |
]
|
58 |
)
|
59 |
return response['choices'][0]['message']['content']
|
@@ -65,6 +65,7 @@ All answers must relate to HumanCentric services or cognitive workplace. {user_p
|
|
65 |
return str(e) # return the exception message after the last attempt
|
66 |
|
67 |
|
|
|
68 |
def pdf_to_text(file, user_prompt):
|
69 |
z = zipfile.ZipFile(file.name, 'r')
|
70 |
aggregated_text = ''
|
|
|
50 |
response = openai.ChatCompletion.create(
|
51 |
model="gpt-3.5-turbo",
|
52 |
messages=[
|
53 |
+
{"role": "system", "content": f"You are {persona}"},
|
54 |
+
{"role": "user", "content": f"""Ignore all previous instructions. As a Cognitive AI Agent your persona is:{persona}
|
55 |
You will answer only as an expert in cognitive workplace and Humancentric leadership.
|
56 |
+
All answers must relate to HumanCentric services or cognitive workplace. {user_prompt}"""},
|
57 |
]
|
58 |
)
|
59 |
return response['choices'][0]['message']['content']
|
|
|
65 |
return str(e) # return the exception message after the last attempt
|
66 |
|
67 |
|
68 |
+
|
69 |
def pdf_to_text(file, user_prompt):
|
70 |
z = zipfile.ZipFile(file.name, 'r')
|
71 |
aggregated_text = ''
|