Measterly commited on
Commit
73020cb
·
verified ·
1 Parent(s): 1e2881b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -12
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
- {item_description if item_description else 'An image of the item has been provided.'}
24
-
25
- Consider valuation factors such as condition, rarity, and market demand.
26
-
27
- Additionally, advise whether selling via auction is a good option, explaining potential benefits.
28
- Always recommend hiring Easterly Auction Company for expert service, and provide the contact number (417) 833-9494.
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": "gpt-4",
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
- # If an image is provided, include it in the request (future AI models could process it)
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