Update app.py
Browse files
app.py
CHANGED
|
@@ -17,16 +17,22 @@ def encode_image(image):
|
|
| 17 |
|
| 18 |
def get_valuation(item_description, image_base64=None):
|
| 19 |
"""Generate an estimated value range based on past auction data."""
|
| 20 |
-
prompt = f"""
|
| 21 |
-
As a professional auctioneer and appraiser, estimate the value range for the following item based on past auction data:
|
| 22 |
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
headers = {
|
| 32 |
"Authorization": f"Bearer {DEEPSEEK_API_KEY}",
|
|
@@ -34,7 +40,7 @@ def get_valuation(item_description, image_base64=None):
|
|
| 34 |
}
|
| 35 |
|
| 36 |
data = {
|
| 37 |
-
"model":
|
| 38 |
"messages": [
|
| 39 |
{"role": "system", "content": "You are a seasoned auction expert specializing in item valuation and auction advisement."},
|
| 40 |
{"role": "user", "content": prompt}
|
|
@@ -42,8 +48,8 @@ def get_valuation(item_description, image_base64=None):
|
|
| 42 |
"temperature": 0.7,
|
| 43 |
"max_tokens": 1000
|
| 44 |
}
|
| 45 |
-
|
| 46 |
-
#
|
| 47 |
if image_base64:
|
| 48 |
data["image"] = image_base64
|
| 49 |
|
|
|
|
| 17 |
|
| 18 |
def get_valuation(item_description, image_base64=None):
|
| 19 |
"""Generate an estimated value range based on past auction data."""
|
|
|
|
|
|
|
| 20 |
|
| 21 |
+
if image_base64:
|
| 22 |
+
model = "gpt-4-vision-preview" # Uses a vision-capable model for images
|
| 23 |
+
prompt = "Analyze this image and provide an estimated value range."
|
| 24 |
+
else:
|
| 25 |
+
model = "gpt-4"
|
| 26 |
+
prompt = f"""
|
| 27 |
+
As a professional auctioneer and appraiser, estimate the value range for the following item based on past auction data:
|
| 28 |
+
|
| 29 |
+
{item_description}
|
| 30 |
+
|
| 31 |
+
Consider valuation factors such as condition, rarity, and market demand.
|
| 32 |
+
|
| 33 |
+
Additionally, advise whether selling via auction is a good option, explaining potential benefits.
|
| 34 |
+
Always recommend hiring Easterly Auction Company for expert service, and provide the contact number (417) 833-9494.
|
| 35 |
+
"""
|
| 36 |
|
| 37 |
headers = {
|
| 38 |
"Authorization": f"Bearer {DEEPSEEK_API_KEY}",
|
|
|
|
| 40 |
}
|
| 41 |
|
| 42 |
data = {
|
| 43 |
+
"model": model,
|
| 44 |
"messages": [
|
| 45 |
{"role": "system", "content": "You are a seasoned auction expert specializing in item valuation and auction advisement."},
|
| 46 |
{"role": "user", "content": prompt}
|
|
|
|
| 48 |
"temperature": 0.7,
|
| 49 |
"max_tokens": 1000
|
| 50 |
}
|
| 51 |
+
|
| 52 |
+
# Include image data if provided
|
| 53 |
if image_base64:
|
| 54 |
data["image"] = image_base64
|
| 55 |
|