Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -242,7 +242,7 @@ def send_request_to_openai(prompt: str) -> Optional[Dict[str, Any]]:
|
|
242 |
]
|
243 |
|
244 |
try:
|
245 |
-
|
246 |
model="gpt-3.5-turbo-16k",
|
247 |
messages=messages,
|
248 |
temperature=1.0,
|
@@ -252,7 +252,7 @@ def send_request_to_openai(prompt: str) -> Optional[Dict[str, Any]]:
|
|
252 |
presence_penalty=0.0
|
253 |
)
|
254 |
|
255 |
-
json_string =
|
256 |
parsed_response = json.loads(json_string)
|
257 |
|
258 |
print(f"English name: {parsed_response['name_en']}")
|
|
|
242 |
]
|
243 |
|
244 |
try:
|
245 |
+
openai_response = client.chat.completions.create(
|
246 |
model="gpt-3.5-turbo-16k",
|
247 |
messages=messages,
|
248 |
temperature=1.0,
|
|
|
252 |
presence_penalty=0.0
|
253 |
)
|
254 |
|
255 |
+
json_string = openai_response.choices[0].message.content
|
256 |
parsed_response = json.loads(json_string)
|
257 |
|
258 |
print(f"English name: {parsed_response['name_en']}")
|