Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -723,7 +723,7 @@ g_auth = os.environ.get("g_auth")
|
|
| 723 |
auth2 = os.environ.get("auth2")
|
| 724 |
auth4 = os.environ.get("auth4")
|
| 725 |
openai.api_key = auth
|
| 726 |
-
openai.api_base =
|
| 727 |
vis_url = os.environ.get("vis_url")
|
| 728 |
vis_auth = os.environ.get("vis_auth")
|
| 729 |
endpoint = os.environ.get("endpoint")
|
|
@@ -874,8 +874,12 @@ def classify(platform, UserInput, Images, Textbox2, Textbox3):
|
|
| 874 |
|
| 875 |
print("IMAGGGGEEE;",Images)
|
| 876 |
|
| 877 |
-
response = requests.request("POST", "https://api.
|
| 878 |
-
print("GGGGG:",response.content)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 879 |
# response = response.json()
|
| 880 |
# res = response["choices"][0]["message"]["content"]
|
| 881 |
return response.content
|
|
|
|
| 723 |
auth2 = os.environ.get("auth2")
|
| 724 |
auth4 = os.environ.get("auth4")
|
| 725 |
openai.api_key = auth
|
| 726 |
+
openai.api_base = "https://api.openai.com/v1/chat/completions"
|
| 727 |
vis_url = os.environ.get("vis_url")
|
| 728 |
vis_auth = os.environ.get("vis_auth")
|
| 729 |
endpoint = os.environ.get("endpoint")
|
|
|
|
| 874 |
|
| 875 |
print("IMAGGGGEEE;",Images)
|
| 876 |
|
| 877 |
+
# response = requests.request("POST", "https://api.openai.com/v1/chat/completions", headers=headers, data=payload)
|
| 878 |
+
# print("GGGGG:",response.content)
|
| 879 |
+
response = openai.ChatCompletion.create(
|
| 880 |
+
model="gpt-3.5-turbo",
|
| 881 |
+
messages=messages
|
| 882 |
+
)
|
| 883 |
# response = response.json()
|
| 884 |
# res = response["choices"][0]["message"]["content"]
|
| 885 |
return response.content
|