Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -50,8 +50,8 @@ def call_openai_api(persona, user_prompt):
|
|
50 |
response = openai.ChatCompletion.create(
|
51 |
model="gpt-3.5-turbo",
|
52 |
messages=[
|
53 |
-
{"role": "system", "content":
|
54 |
-
{"role": "user", "content": f"{persona}{user_prompt}",
|
55 |
]
|
56 |
)
|
57 |
return response['choices'][0]['message']['content']
|
@@ -62,6 +62,7 @@ def call_openai_api(persona, user_prompt):
|
|
62 |
else:
|
63 |
return str(e) # return the exception message after the last attempt
|
64 |
|
|
|
65 |
def pdf_to_text(file, user_prompt):
|
66 |
z = zipfile.ZipFile(file.name, 'r')
|
67 |
aggregated_text = ''
|
|
|
50 |
response = openai.ChatCompletion.create(
|
51 |
model="gpt-3.5-turbo",
|
52 |
messages=[
|
53 |
+
{"role": "system", "content": "You are a knowledgeable assistant that provides short factual answers"},
|
54 |
+
{"role": "user", "content": f"{persona}{user_prompt}"}, # Note the closing bracket here
|
55 |
]
|
56 |
)
|
57 |
return response['choices'][0]['message']['content']
|
|
|
62 |
else:
|
63 |
return str(e) # return the exception message after the last attempt
|
64 |
|
65 |
+
|
66 |
def pdf_to_text(file, user_prompt):
|
67 |
z = zipfile.ZipFile(file.name, 'r')
|
68 |
aggregated_text = ''
|