Delete app.py
Browse files12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182import gradio as gr
def graphic_design_chatbot(user_message, history): if history is None: history = [] user_message_lower = user_message.lower()
if any(word in user_message_lower for word in ["logo", "branding"]): response = ( "For logo and branding design, consider using vector graphic software like Adobe Illustrator " "or Inkscape. Keep your designs simple, memorable, and versatile across mediums." ) elif any(word in user_message_lower for word in ["color", "palette", "colors"]): response = ( "Color palettes set the tone of your design. Use tools like Coolors.co or Adobe Color to create " "harmonious and accessible color schemes based on color theory." ) elif any(word in user_message_lower for word in ["font", "typography"]): response = ( "Typography is essential to communicate your message. Google Fonts offers free, modern typefaces " "with great readability. Mind line height, contrast, and pairing font styles carefully." ) elif any(word in user_message_lower for word in ["layout", "composition", "grid"]): response = ( "Use grids and layout principles—alignment, proximity, balance—to structure your designs clearly. " "Figma and Adobe XD are excellent tools for experimenting with layout." ) elif any(word in user_message_lower for word in ["software", "tool", "tools"]): response = ( "Popular graphic design software includes Adobe Photoshop, Illustrator, Figma, Sketch (Mac only), " "and Affinity Designer. Choose based on your workflow and platform." ) elif any(word in user_message_lower for word in ["trends", "inspiration"]): response = ( "Stay inspired by following Dribbble, Behance, and Awwwards for current design trends and creative ideas." ) else: response = ( "I'm specialized in graphic design advice! Ask me about logos, colors, typography, layouts, tools, or trends." )
history.append((user_message, response)) return history, history
with gr.Blocks(css=""" body {background-color: #ffffff; font-family: 'Inter', sans-serif; margin: 0; padding: 0;} #container {max-width: 800px; margin: 2rem auto; padding: 0 1rem;} #header {font-weight: 700; font-size: 48px; color: #111827; margin-bottom: 0.5rem;} #subheader {color: #6b7280; font-size: 18px; margin-bottom: 2rem;} .gradio-chatbot {border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.05); overflow: hidden;} .gradio-chatbot .message.user {font-weight: 600; color: #111827;} .gradio-chatbot .message.bot {color: #374151;} .input-container {margin-top: 1rem;} .send-button {background-color: #111827; color: white; border-radius: 8px; padding: 0.75rem 1.5rem; font-weight: 600; border: none; cursor: pointer; transition: background-color 0.3s ease;} .send-button:hover {background-color: #374151;}""") as demo: with gr.Row(): with gr.Column(): gr.Markdown("<div id='container'><h1 id='header'>🎨 Graphic Design Recommendation Chatbot</h1>" "<p id='subheader'>Ask anything about graphic design, from tools to best practices.</p></div>")
chatbot = gr.Chatbot(elem_id="chatbot").style(height=400) user_input = gr.Textbox( placeholder="Type your question about graphic design here...", show_label=False, elem_id="user_input" ) state = gr.State([])
def submit_message(user_message, history): return graphic_design_chatbot(user_message, history)
user_input.submit(submit_message, inputs=[user_input, state], outputs=[chatbot, state]) user_input.submit(lambda: "", None, user_input) # clear input after submit
send_btn = gr.Button("Send", elem_id="send-btn", css_class="send-button") send_btn.click(submit_message, inputs=[user_input, state], outputs=[chatbot, state]) send_btn.click(lambda: "", None, user_input)
if __name__ == "__main__": demo.launch()
app.pyDeleted-82