Spaces:
Running
Running
Commit
·
0fc96a0
1
Parent(s):
8853f8e
update prompt
Browse files
app.py
CHANGED
@@ -12,115 +12,85 @@ client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
|
|
12 |
script_dir = os.path.dirname(os.path.abspath(__file__))
|
13 |
|
14 |
printer_1 = """
|
15 |
-
#
|
16 |
-
Product: Business
|
17 |
-
Surface Options:
|
18 |
-
plastic:
|
19 |
-
multiplier: 1.0
|
20 |
-
cardboard:
|
21 |
-
multiplier: 0.9
|
22 |
-
wood:
|
23 |
-
multiplier: 1.3
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
|
|
|
|
|
|
28 |
|
29 |
-
|
30 |
-
|
31 |
-
|
|
|
|
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
removable: multiplier 1.2
|
37 |
|
38 |
Base Prices (Quantity,Price per Unit $):
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
500,0.36
|
44 |
-
1000,0.2
|
45 |
-
2000,0.14
|
46 |
-
5000,0.12
|
47 |
-
10000,0.09
|
48 |
-
20000,0.07
|
49 |
"""
|
50 |
|
51 |
printer_2 = """
|
52 |
# BannerLord
|
53 |
-
Product: Business
|
54 |
-
Surface Options:
|
55 |
-
plastic:
|
56 |
-
multiplier: 1.0
|
57 |
-
cardboard:
|
58 |
-
multiplier: 0.85
|
59 |
-
wood:
|
60 |
-
multiplier: 1.4
|
61 |
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
|
66 |
-
|
67 |
-
|
68 |
-
|
|
|
|
|
|
|
|
|
69 |
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
removable: multiplier 1.25
|
74 |
|
75 |
Base Prices (Quantity,Price per Unit $):
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
500,0.4
|
81 |
-
1000,0.22
|
82 |
-
2000,0.15
|
83 |
-
5000,0.14
|
84 |
-
10000,0.1
|
85 |
-
20000,0.075
|
86 |
"""
|
87 |
|
88 |
printer_3 = """
|
89 |
# PrintMaster
|
90 |
-
Product: Business
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
multiplier: 1.1
|
96 |
-
wood:
|
97 |
-
multiplier: 1.25
|
98 |
|
99 |
Sizes:
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
removable: multiplier 1.22
|
111 |
|
112 |
Base Prices (Quantity,Price per Unit $):
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
200,0.875
|
118 |
-
250,0.72
|
119 |
-
500,0.4
|
120 |
-
750,0.4
|
121 |
-
1000,0.35
|
122 |
-
1500,0.3
|
123 |
-
2000,0.25
|
124 |
"""
|
125 |
|
126 |
|
@@ -141,14 +111,14 @@ def find_best_price(request):
|
|
141 |
" - Multiplying by the label type multiplier\n"
|
142 |
"3. Do not use linear interpolation for quantities - use the nearest lower quantity pricing.\n\n"
|
143 |
"Example:\n"
|
144 |
-
"User: I want to print 600 business cards, 6x6 cm size,
|
145 |
"Answer:\n"
|
146 |
-
"
|
147 |
"###\n"
|
148 |
"BannerLord: Total for 600: $524.40\n"
|
149 |
"###\n"
|
150 |
"PrintMaster: Total for 600: $497.40\n\n"
|
151 |
-
"If user haven't specified one of the parameters,
|
152 |
"Your response should display ONLY final pricing for each available option, nothing more"
|
153 |
"The '###' symbol must separate each printer's price calculation.\n"
|
154 |
)
|
@@ -250,8 +220,8 @@ iface = gr.Interface(
|
|
250 |
fn=find_best_price,
|
251 |
inputs=gr.Textbox(lines=3, placeholder="Enter what are you looking for"),
|
252 |
outputs=[
|
253 |
-
gr.Textbox(label="Result"),
|
254 |
gr.HTML(label="Product Image"),
|
|
|
255 |
],
|
256 |
title="Get Instant Quote",
|
257 |
description=f"""
|
|
|
12 |
script_dir = os.path.dirname(os.path.abspath(__file__))
|
13 |
|
14 |
printer_1 = """
|
15 |
+
# PrintPronto
|
16 |
+
Product: Business card
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
+
Color:
|
19 |
+
- Black (default)
|
20 |
+
- Blue
|
21 |
+
- Brown
|
22 |
+
- Orange
|
23 |
+
- Pink
|
24 |
|
25 |
+
Sizes:
|
26 |
+
3.5x2: multiplier 1.0
|
27 |
+
2.5x2.5: multiplier 0.95
|
28 |
+
2.125x3.375: multiplier 0.9
|
29 |
+
Custom size: This vendor doesn't support custom sizes
|
30 |
|
31 |
+
Material:
|
32 |
+
Standard (default): multiplier 1.0
|
33 |
+
Uncoated: multiplier 0.9
|
|
|
34 |
|
35 |
Base Prices (Quantity,Price per Unit $):
|
36 |
+
100, 0.23
|
37 |
+
250, 0.2
|
38 |
+
500, 1.9
|
39 |
+
1000, 1.75
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
"""
|
41 |
|
42 |
printer_2 = """
|
43 |
# BannerLord
|
44 |
+
Product: Business card
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
|
46 |
+
Color:
|
47 |
+
- Black (default)
|
48 |
+
- Blue
|
49 |
|
50 |
+
Sizes:
|
51 |
+
3.5x2: multiplier 1.0
|
52 |
+
2.5x2.5: multiplier 0.95
|
53 |
+
2.125x3.375: multiplier 0.9
|
54 |
+
3x2: multiplier 1.5
|
55 |
+
4x3: multiplier 1.5
|
56 |
+
Custom size: multiplier 2.0
|
57 |
|
58 |
+
Material:
|
59 |
+
Standard (default): multiplier 1.0
|
60 |
+
Uncoated: multiplier 0.95
|
|
|
61 |
|
62 |
Base Prices (Quantity,Price per Unit $):
|
63 |
+
100, 0.25
|
64 |
+
250, 0.22
|
65 |
+
500, 0.2
|
66 |
+
1000, 1.85
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
"""
|
68 |
|
69 |
printer_3 = """
|
70 |
# PrintMaster
|
71 |
+
Product: Business card
|
72 |
+
Color:
|
73 |
+
- Black (default)
|
74 |
+
- Blue
|
75 |
+
- Brown
|
|
|
|
|
|
|
76 |
|
77 |
Sizes:
|
78 |
+
3.5x2: multiplier 1.0
|
79 |
+
2.5x2.5: multiplier 0.95
|
80 |
+
2.125x3.375: multiplier 0.9
|
81 |
+
3x2: multiplier 1.5
|
82 |
+
4x3: multiplier 1.5
|
83 |
+
Custom size: multiplier 2.0
|
84 |
|
85 |
+
Material:
|
86 |
+
Standard (default): multiplier 1.0
|
87 |
+
Uncoated: multiplier 0.85
|
|
|
88 |
|
89 |
Base Prices (Quantity,Price per Unit $):
|
90 |
+
100, 0.21
|
91 |
+
250, 0.2
|
92 |
+
500, 0.18
|
93 |
+
1000, 0.17
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
"""
|
95 |
|
96 |
|
|
|
111 |
" - Multiplying by the label type multiplier\n"
|
112 |
"3. Do not use linear interpolation for quantities - use the nearest lower quantity pricing.\n\n"
|
113 |
"Example:\n"
|
114 |
+
"User: I want to print 600 business cards, 6x6 cm size, \n"
|
115 |
"Answer:\n"
|
116 |
+
"PrinterPronto: Doesn't support custom size\n"
|
117 |
"###\n"
|
118 |
"BannerLord: Total for 600: $524.40\n"
|
119 |
"###\n"
|
120 |
"PrintMaster: Total for 600: $497.40\n\n"
|
121 |
+
"If user haven't specified one of the parameters, use the default one"
|
122 |
"Your response should display ONLY final pricing for each available option, nothing more"
|
123 |
"The '###' symbol must separate each printer's price calculation.\n"
|
124 |
)
|
|
|
220 |
fn=find_best_price,
|
221 |
inputs=gr.Textbox(lines=3, placeholder="Enter what are you looking for"),
|
222 |
outputs=[
|
|
|
223 |
gr.HTML(label="Product Image"),
|
224 |
+
gr.Textbox(label="AI response: text mode"),
|
225 |
],
|
226 |
title="Get Instant Quote",
|
227 |
description=f"""
|