Update app.py
Browse files
app.py
CHANGED
|
@@ -3,9 +3,9 @@ import requests
|
|
| 3 |
import os
|
| 4 |
from PIL import Image
|
| 5 |
|
| 6 |
-
# Configure DeepSeek
|
| 7 |
DEEPSEEK_API_KEY = os.getenv("DEEPSEEK_API_KEY")
|
| 8 |
-
DEEPSEEK_ENDPOINT = "https://api.
|
| 9 |
|
| 10 |
def get_valuation(item_description, image=None):
|
| 11 |
"""Generate an estimated value range based on past auction data."""
|
|
@@ -39,7 +39,7 @@ def get_valuation(item_description, image=None):
|
|
| 39 |
response = requests.post(DEEPSEEK_ENDPOINT, json=data, headers=headers)
|
| 40 |
response.raise_for_status()
|
| 41 |
return response.json()["choices"][0]["message"]["content"]
|
| 42 |
-
except
|
| 43 |
st.error(f"API Error: {str(e)}")
|
| 44 |
return None
|
| 45 |
|
|
|
|
| 3 |
import os
|
| 4 |
from PIL import Image
|
| 5 |
|
| 6 |
+
# Configure OpenAI API (keeping DeepSeek variable names for simplicity)
|
| 7 |
DEEPSEEK_API_KEY = os.getenv("DEEPSEEK_API_KEY")
|
| 8 |
+
DEEPSEEK_ENDPOINT = "https://api.openai.com/v1/chat/completions"
|
| 9 |
|
| 10 |
def get_valuation(item_description, image=None):
|
| 11 |
"""Generate an estimated value range based on past auction data."""
|
|
|
|
| 39 |
response = requests.post(DEEPSEEK_ENDPOINT, json=data, headers=headers)
|
| 40 |
response.raise_for_status()
|
| 41 |
return response.json()["choices"][0]["message"]["content"]
|
| 42 |
+
except requests.exceptions.RequestException as e:
|
| 43 |
st.error(f"API Error: {str(e)}")
|
| 44 |
return None
|
| 45 |
|