Spaces:
Sleeping
Sleeping
Commit
·
72a5665
1
Parent(s):
baec54e
update product card description
Browse files
app.py
CHANGED
@@ -138,6 +138,23 @@ def find_best_price(request):
|
|
138 |
|
139 |
|
140 |
def render_html_page(chat_text):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
images = [
|
142 |
os.path.join(script_dir, "public/src/painted-edge-business-card-05.png"),
|
143 |
os.path.join(
|
@@ -152,7 +169,7 @@ def render_html_page(chat_text):
|
|
152 |
]
|
153 |
|
154 |
# Split chat_text into product descriptions
|
155 |
-
product_descriptions =
|
156 |
|
157 |
# Generate HTML content
|
158 |
html_content = """
|
|
|
138 |
|
139 |
|
140 |
def render_html_page(chat_text):
|
141 |
+
formatting_prompt = (
|
142 |
+
"format this text for product card. It needs to be like this:\n"
|
143 |
+
"Vendor name 1: $price for 'amount'"
|
144 |
+
"###"
|
145 |
+
"Vendor name 2: $price for 'amount'"
|
146 |
+
"###"
|
147 |
+
"And so on for the rest of the vendors"
|
148 |
+
)
|
149 |
+
|
150 |
+
chat_response = client.chat.completions.create(
|
151 |
+
model="gpt-4o-mini",
|
152 |
+
messages=[
|
153 |
+
{"role": "system", "content": formatting_prompt},
|
154 |
+
{"role": "user", "content": chat_text},
|
155 |
+
],
|
156 |
+
)
|
157 |
+
formatted_text = chat_response.choices[0].message.content
|
158 |
images = [
|
159 |
os.path.join(script_dir, "public/src/painted-edge-business-card-05.png"),
|
160 |
os.path.join(
|
|
|
169 |
]
|
170 |
|
171 |
# Split chat_text into product descriptions
|
172 |
+
product_descriptions = formatted_text.split("###")
|
173 |
|
174 |
# Generate HTML content
|
175 |
html_content = """
|