# ... (previous code remains the same) # Combine Ethos description and attributes into a prompt input_text = f"""Generate a detailed, luxurious 150-word description for the following watch, focusing on its craftsmanship, innovation, and design. Use a style similar to high-end watch editorials, highlighting the watch's unique features and its appeal to connoisseurs: Brand: {attributes['brand']} Name: {attributes['name']} SKU: {attributes['sku']} Features: {attributes['features']} Case Size: {attributes['casesize']} Movement: {attributes['movement']} Gender: {attributes['gender']} Water Resistance: {attributes['water_resistance']} Power Reserve: {attributes['power_reserve']} Dial Color: {attributes['dial_color']} Strap Material: {attributes['strap_material']} Additional details from Ethos: {ethos_description} Description:""" # Tokenize input and generate description inputs = tokenizer(input_text, return_tensors="pt", max_length=512, truncation=True) outputs = model.generate( **inputs, max_length=300, # Increased to allow for longer descriptions min_length=200, # Ensure a minimum length num_return_sequences=1, temperature=0.8, # Slightly increased for more creativity top_k=50, top_p=0.95, do_sample=True, repetition_penalty=1.2, # Prevent repetition length_penalty=1.5 # Encourage longer outputs ) # Decode generated text description = tokenizer.decode(outputs[0], skip_special_tokens=True) # Display the final generated description st.write("### Final Generated Description") st.write(description) # ... (rest of the code remains the same)