alapl063 commited on
Commit
c263614
·
verified ·
1 Parent(s): 862550c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +47 -7
app.py CHANGED
@@ -90,14 +90,32 @@ def reset_chat():
90
 
91
  # Gradio UI
92
  with gr.Blocks(css="""
93
- body { background-color: #2D336B; }
94
  .gradio-container { background-color: #A9B5DF; }
95
-
96
 
97
  #chat-container {
98
  height: 50vh !important;
99
  max-height: 50vh !important;
100
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  """) as demo:
102
  gr.Markdown("""
103
  # 🌍 ***FlightAI - Your Travel Assistant / Votre Assistant de Voyage*** ✈️
@@ -109,9 +127,8 @@ with gr.Blocks(css="""
109
 
110
  chatbot = gr.Chatbot(value=[("", translations["en"]["welcome"])], elem_id="chat-container")
111
 
112
-
113
  state = gr.State([]) # Store conversation history
114
-
115
  with gr.Row():
116
  btn1 = gr.Button("Trip recommendations / Recommendations de Voyage", elem_classes=["gradio-button"])
117
  btn2 = gr.Button("Send me somewhere! / Envoyez-moi quelque part!", elem_classes=["gradio-button"])
@@ -123,7 +140,32 @@ with gr.Blocks(css="""
123
 
124
  with gr.Column(elem_classes=["centered"]):
125
  reset_button = gr.Button("Reset Chat")
126
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
  def submit_msg(message, history):
128
  if not message.strip():
129
  return chat_with_bot("", history)
@@ -135,8 +177,6 @@ with gr.Blocks(css="""
135
 
136
  return gr.update(value=updated_history), ""
137
 
138
-
139
-
140
  def button_click(btn_text, history):
141
  updated_history, _ = chat_with_bot(btn_text, history)
142
  return updated_history, ""
 
90
 
91
  # Gradio UI
92
  with gr.Blocks(css="""
93
+ body { background-color: #A9B5DF; }
94
  .gradio-container { background-color: #A9B5DF; }
 
95
 
96
  #chat-container {
97
  height: 50vh !important;
98
  max-height: 50vh !important;
99
  }
100
+
101
+ .gradio-button {
102
+ background-color: #7886C7 !important;
103
+ color: white !important;
104
+ border: none !important;
105
+ padding: 10px 15px !important;
106
+ font-size: 16px !important;
107
+ font-weight: bold !important;
108
+ border-radius: 5px !important;
109
+ cursor: pointer !important;
110
+ }
111
+
112
+ .gradio-button:hover {
113
+ background-color: #5f6bb4 !important;
114
+ }
115
+
116
+ .chat-text {
117
+ font-size: 16px !important;
118
+ }
119
  """) as demo:
120
  gr.Markdown("""
121
  # 🌍 ***FlightAI - Your Travel Assistant / Votre Assistant de Voyage*** ✈️
 
127
 
128
  chatbot = gr.Chatbot(value=[("", translations["en"]["welcome"])], elem_id="chat-container")
129
 
 
130
  state = gr.State([]) # Store conversation history
131
+
132
  with gr.Row():
133
  btn1 = gr.Button("Trip recommendations / Recommendations de Voyage", elem_classes=["gradio-button"])
134
  btn2 = gr.Button("Send me somewhere! / Envoyez-moi quelque part!", elem_classes=["gradio-button"])
 
140
 
141
  with gr.Column(elem_classes=["centered"]):
142
  reset_button = gr.Button("Reset Chat")
143
+
144
+ # Customization options
145
+ with gr.Row():
146
+ text_size_dropdown = gr.Dropdown(choices=["Small", "Medium", "Large"], label="Text Size", value="Medium")
147
+ button_color_picker = gr.ColorPicker(label="Button Color", value="#7886C7")
148
+
149
+ def update_styles(text_size, button_color):
150
+ """Dynamically update chat text size and button colors."""
151
+ text_sizes = {"Small": "12px", "Medium": "16px", "Large": "20px"}
152
+ return f"""
153
+ <style>
154
+ .chat-text {{ font-size: {text_sizes[text_size]} !important; }}
155
+ .gradio-button {{
156
+ background-color: {button_color} !important;
157
+ }}
158
+ .gradio-button:hover {{
159
+ background-color: {button_color[:-2]}AA !important;
160
+ }}
161
+ </style>
162
+ """
163
+
164
+ custom_styles = gr.HTML(update_styles("Medium", "#7886C7"))
165
+
166
+ text_size_dropdown.change(update_styles, inputs=[text_size_dropdown, button_color_picker], outputs=[custom_styles])
167
+ button_color_picker.change(update_styles, inputs=[text_size_dropdown, button_color_picker], outputs=[custom_styles])
168
+
169
  def submit_msg(message, history):
170
  if not message.strip():
171
  return chat_with_bot("", history)
 
177
 
178
  return gr.update(value=updated_history), ""
179
 
 
 
180
  def button_click(btn_text, history):
181
  updated_history, _ = chat_with_bot(btn_text, history)
182
  return updated_history, ""