antoinette-f commited on
Commit
7f8d54c
·
verified ·
1 Parent(s): dd4bb67

updated UI to add colours

Browse files
Files changed (1) hide show
  1. app.py +45 -2
app.py CHANGED
@@ -132,8 +132,9 @@ def respond(message, chat_history):
132
  # Return the updated chat history and the image paths
133
  return chat_history, image_paths
134
 
 
135
  # Gradio UI ---
136
- with gr.Blocks(theme=gr.themes.Soft()) as demo:
137
  gr.Markdown("## Fashioneer - your fashion pioneer!")
138
  gr.Markdown("Ask me what to wear and I'll suggest clothing with images from the database.")
139
 
@@ -148,5 +149,47 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
148
  # This is the original line that connects the input and output
149
  user_input.submit(fn=respond, inputs=[user_input, chatbot], outputs=[chatbot, gallery])
150
 
151
- # This starts the Gradio app
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
  demo.launch()
 
132
  # Return the updated chat history and the image paths
133
  return chat_history, image_paths
134
 
135
+
136
  # Gradio UI ---
137
+ with gr.Blocks(theme=custom_theme, css=css) as demo:
138
  gr.Markdown("## Fashioneer - your fashion pioneer!")
139
  gr.Markdown("Ask me what to wear and I'll suggest clothing with images from the database.")
140
 
 
149
  # This is the original line that connects the input and output
150
  user_input.submit(fn=respond, inputs=[user_input, chatbot], outputs=[chatbot, gallery])
151
 
152
+ # Define custom colors from your palette
153
+ pink_bg = "#EBBAB9"
154
+ dark_blue_output = "#407076"
155
+ light_blue_input = "#698996"
156
+ gold_border = "#D3AF37"
157
+
158
+ # Create a custom theme based on the Soft theme
159
+ custom_theme = gr.themes.Soft(
160
+ # Set the primary color (affects buttons, etc.)
161
+ primary_hue="zinc",
162
+ # Set the secondary color (affects backgrounds, etc.)
163
+ secondary_hue="zinc",
164
+ ).set(
165
+ # Set the main background color
166
+ body_background_fill=pink_bg,
167
+ # Set the border color for the image gallery
168
+ block_border_color=gold_border,
169
+ # Set the background color for all components
170
+ input_background_fill=light_blue_input,
171
+ block_background_fill=light_blue_input,
172
+ # Set the background for the output components like the chatbot and gallery
173
+ input_background_fill_dark=light_blue_input,
174
+ block_background_fill_dark=dark_blue_output
175
+ )
176
+
177
+ # Custom CSS for the golden border around images
178
+ css = """
179
+ .gallery-item {
180
+ border: 3px solid var(--gold_border) !important;
181
+ }
182
+ """
183
+ custom_theme = gr.themes.Soft(
184
+ # Set the primary color (affects buttons, etc.)
185
+ primary_hue="zinc",
186
+ # Set the secondary color (affects backgrounds, etc.)
187
+ secondary_hue="zinc",
188
+ ).set(
189
+ # ... your other color definitions
190
+ ).add_css_body(
191
+ name="gold_border",
192
+ value="#D3AF37"
193
+ )
194
+
195
  demo.launch()