Spaces:
Running
Running
changed prompt for determining the ammount of products in request
Browse files
app.py
CHANGED
@@ -1,10 +1,11 @@
|
|
1 |
import base64
|
2 |
-
import gradio as gr
|
3 |
-
from openai import OpenAI
|
4 |
import os
|
5 |
-
import dotenv
|
6 |
import re
|
7 |
|
|
|
|
|
|
|
|
|
8 |
dotenv.load_dotenv()
|
9 |
|
10 |
client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
|
@@ -465,7 +466,8 @@ def extract_requested_products(request, product_names):
|
|
465 |
"Here are the available product names:\n"
|
466 |
f"{product_list}\n"
|
467 |
"Identify any products explicitly or implicitly mentioned in the user's request. "
|
468 |
-
"If a product is mentioned in different sizes, consider each size as a separate product
|
|
|
469 |
"If no products match, respond with 'None'. Output the result as a Python list. "
|
470 |
"Your response should contain only the list or 'None'."
|
471 |
)
|
@@ -532,6 +534,8 @@ def render_html_page(chat_text, images_to_use):
|
|
532 |
]
|
533 |
processed_links = [link for img in images_to_use for link in IMAGES[img]["links"]]
|
534 |
processed_prices = extract_total_prices(chat_text)
|
|
|
|
|
535 |
|
536 |
for i in range(len(processed_images)):
|
537 |
image = processed_images[i]
|
|
|
1 |
import base64
|
|
|
|
|
2 |
import os
|
|
|
3 |
import re
|
4 |
|
5 |
+
import dotenv
|
6 |
+
import gradio as gr
|
7 |
+
from openai import OpenAI
|
8 |
+
|
9 |
dotenv.load_dotenv()
|
10 |
|
11 |
client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
|
|
|
466 |
"Here are the available product names:\n"
|
467 |
f"{product_list}\n"
|
468 |
"Identify any products explicitly or implicitly mentioned in the user's request. "
|
469 |
+
"If a product is mentioned in different sizes, consider each size as a separate product and include them in the list. "
|
470 |
+
"However, do not include duplicate entries of the same product unless explicitly mentioned multiple times in the request. "
|
471 |
"If no products match, respond with 'None'. Output the result as a Python list. "
|
472 |
"Your response should contain only the list or 'None'."
|
473 |
)
|
|
|
534 |
]
|
535 |
processed_links = [link for img in images_to_use for link in IMAGES[img]["links"]]
|
536 |
processed_prices = extract_total_prices(chat_text)
|
537 |
+
# print(chat_text)
|
538 |
+
# print(processed_prices)
|
539 |
|
540 |
for i in range(len(processed_images)):
|
541 |
image = processed_images[i]
|