import streamlit as st from app import generate_response # Title and Description st.title("UI/UX Design Assistant Chatbot") st.markdown( """ Welcome to the **UI/UX Design Assistant**! 🎨 This AI chatbot helps you: - Create actionable design suggestions - Generate visual templates - Provide Figma-ready designs Fill in the details below to get started! """ ) # User Inputs task = st.text_input("Describe your design task (e.g., 'landing page design')", key="task_input") style = st.selectbox( "Select a design style:", ["modern minimalist", "vintage", "playful", "corporate", "futuristic"], key="style_select" ) requirements = st.text_area("Enter specific functional requirements (optional):", key="requirements_input") # Generate Button if st.button("Generate Design", key="generate_button"): # Check if required fields are filled if not task.strip(): st.error("⚠️ Please provide a design task before generating.") else: with st.spinner("Generating your design... 🚀"): try: # Generate response response = generate_response(task.strip(), style, requirements.strip()) # Display Textual Suggestions st.subheader("💡 Textual Suggestions:") if response.get("text"): st.write(response["text"]) else: st.warning("⚠️ No textual suggestions generated. Please refine your input and try again.") # Display Visual Template st.subheader("🖼️ Visual Template:") if response.get("visual_template") and "Error" not in response["visual_template"]: st.image(response["visual_template"], caption="Generated Visual Template") else: st.warning("⚠️ No visual template available or an error occurred.") # Display Figma Template Link st.subheader("📁 Figma Template:") if response.get("figma_template") and "Error" not in response["figma_template"]: st.write(f"[View Template in Figma]({response['figma_template']})") else: st.warning("⚠️ No Figma template available or an error occurred.") except Exception as e: st.error(f"❌ An error occurred while generating the design: {e}") # Footer st.markdown("---") st.markdown("💡 **Tip**: Ensure your inputs are clear and concise for the best results.")