Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -51,7 +51,7 @@ if selected_brand != "Select":
|
|
51 |
if image_url:
|
52 |
st.image(image_url, caption=f"{watch_data['name']} Image")
|
53 |
|
54 |
-
#
|
55 |
attributes = {
|
56 |
"brand": watch_data["brand"],
|
57 |
"name": watch_data.get("name", "Unknown Watch"),
|
@@ -63,11 +63,10 @@ if selected_brand != "Select":
|
|
63 |
"water_resistance": watch_data.get("water_resistance", "Unknown Water Resistance"),
|
64 |
"power_reserve": watch_data.get("power_reserve", "Unknown Power Reserve"),
|
65 |
"dial_color": watch_data.get("dial_color", "Unknown Dial Color"),
|
66 |
-
"strap_material": watch_data.get("strap_material", "Unknown Strap Material")
|
67 |
-
"price": watch_data.get("price", "Unknown Price"),
|
68 |
}
|
69 |
|
70 |
-
#
|
71 |
input_text = f"""Generate a detailed 100-word description for the following watch:
|
72 |
Brand: {attributes['brand']}
|
73 |
Name: {attributes['name']}
|
@@ -80,9 +79,8 @@ Water Resistance: {attributes['water_resistance']}
|
|
80 |
Power Reserve: {attributes['power_reserve']}
|
81 |
Dial Color: {attributes['dial_color']}
|
82 |
Strap Material: {attributes['strap_material']}
|
83 |
-
Price: {attributes['price']}
|
84 |
|
85 |
-
Description:"""
|
86 |
|
87 |
# Tokenize input and generate description
|
88 |
inputs = tokenizer(input_text, return_tensors="pt", max_length=512, truncation=True)
|
|
|
51 |
if image_url:
|
52 |
st.image(image_url, caption=f"{watch_data['name']} Image")
|
53 |
|
54 |
+
# Attributes without price
|
55 |
attributes = {
|
56 |
"brand": watch_data["brand"],
|
57 |
"name": watch_data.get("name", "Unknown Watch"),
|
|
|
63 |
"water_resistance": watch_data.get("water_resistance", "Unknown Water Resistance"),
|
64 |
"power_reserve": watch_data.get("power_reserve", "Unknown Power Reserve"),
|
65 |
"dial_color": watch_data.get("dial_color", "Unknown Dial Color"),
|
66 |
+
"strap_material": watch_data.get("strap_material", "Unknown Strap Material")
|
|
|
67 |
}
|
68 |
|
69 |
+
# Create a detailed description prompt following your preferred style
|
70 |
input_text = f"""Generate a detailed 100-word description for the following watch:
|
71 |
Brand: {attributes['brand']}
|
72 |
Name: {attributes['name']}
|
|
|
79 |
Power Reserve: {attributes['power_reserve']}
|
80 |
Dial Color: {attributes['dial_color']}
|
81 |
Strap Material: {attributes['strap_material']}
|
|
|
82 |
|
83 |
+
Description: Provide a luxurious, detailed description focusing on the craftsmanship, innovation, and design, similar to a high-end editorial style."""
|
84 |
|
85 |
# Tokenize input and generate description
|
86 |
inputs = tokenizer(input_text, return_tensors="pt", max_length=512, truncation=True)
|