capradeepgujaran commited on
Commit
18f5cd8
·
verified ·
1 Parent(s): e637753

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -9
app.py CHANGED
@@ -129,6 +129,7 @@ def chat_about_image(message, chat_history):
129
  return "", chat_history + [(message, f"Error: {str(e)}")]
130
 
131
 
 
132
  # Custom CSS for improved styling
133
  custom_css = """
134
  .container { max-width: 1000px; margin: auto; padding-top: 1.5rem; }
@@ -137,10 +138,12 @@ custom_css = """
137
  .subheader { color: #34495e; font-size: 1.2rem; margin-bottom: 2rem; }
138
  .image-container { border: 2px dashed #3498db; border-radius: 10px; padding: 1rem; text-align: center; }
139
  .analyze-button { background-color: #2ecc71 !important; color: white !important; }
140
- .clear-button { background-color: #e74c3c !important; color: white !important; }
141
  .chatbot { border: 1px solid #bdc3c7; border-radius: 10px; padding: 1rem; height: 400px; overflow-y: auto; }
142
  .chat-input { border: 1px solid #bdc3c7; border-radius: 5px; padding: 0.5rem; }
143
  .groq-badge { position: fixed; bottom: 10px; right: 10px; background-color: #f39c12; color: white; padding: 5px 10px; border-radius: 5px; font-weight: bold; }
 
 
144
  """
145
 
146
  # Create the Gradio interface
@@ -162,14 +165,16 @@ with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as iface:
162
  analyze_button = gr.Button("🔍 Analyze Safety Hazards", elem_classes="analyze-button")
163
  with gr.Column(scale=2):
164
  chatbot = gr.Chatbot(label="Safety Analysis Results and Expert Chat", elem_classes="chatbot")
165
- with gr.Row():
166
- msg = gr.Textbox(
167
- label="Ask about safety measures or regulations",
168
- placeholder="E.g., 'What OSHA guidelines apply to this hazard?'",
169
- show_label=False,
170
- elem_classes="chat-input"
171
- )
172
- clear = gr.Button("🗑️ Clear Chat", elem_classes="clear-button")
 
 
173
 
174
  def update_chat(history, new_message):
175
  history = history or []
 
129
  return "", chat_history + [(message, f"Error: {str(e)}")]
130
 
131
 
132
+ # Custom CSS for improved styling
133
  # Custom CSS for improved styling
134
  custom_css = """
135
  .container { max-width: 1000px; margin: auto; padding-top: 1.5rem; }
 
138
  .subheader { color: #34495e; font-size: 1.2rem; margin-bottom: 2rem; }
139
  .image-container { border: 2px dashed #3498db; border-radius: 10px; padding: 1rem; text-align: center; }
140
  .analyze-button { background-color: #2ecc71 !important; color: white !important; }
141
+ .clear-button { background-color: #e74c3c !important; color: white !important; width: 100px !important; }
142
  .chatbot { border: 1px solid #bdc3c7; border-radius: 10px; padding: 1rem; height: 400px; overflow-y: auto; }
143
  .chat-input { border: 1px solid #bdc3c7; border-radius: 5px; padding: 0.5rem; }
144
  .groq-badge { position: fixed; bottom: 10px; right: 10px; background-color: #f39c12; color: white; padding: 5px 10px; border-radius: 5px; font-weight: bold; }
145
+ .input-row { display: flex; align-items: center; }
146
+ .input-row > div:first-child { flex-grow: 1; margin-right: 10px; }
147
  """
148
 
149
  # Create the Gradio interface
 
165
  analyze_button = gr.Button("🔍 Analyze Safety Hazards", elem_classes="analyze-button")
166
  with gr.Column(scale=2):
167
  chatbot = gr.Chatbot(label="Safety Analysis Results and Expert Chat", elem_classes="chatbot")
168
+ with gr.Row(elem_classes="input-row"):
169
+ with gr.Column(scale=9):
170
+ msg = gr.Textbox(
171
+ label="Ask about safety measures or regulations",
172
+ placeholder="E.g., 'What OSHA guidelines apply to this hazard?'",
173
+ show_label=False,
174
+ elem_classes="chat-input"
175
+ )
176
+ with gr.Column(scale=1):
177
+ clear = gr.Button("🗑️ Clear", elem_classes="clear-button")
178
 
179
  def update_chat(history, new_message):
180
  history = history or []