karthikmn commited on
Commit
0d9d690
·
verified ·
1 Parent(s): e33acc3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -8
app.py CHANGED
@@ -194,7 +194,7 @@ def process_question(q, chat_history):
194
  # --- Chatbot UI with dynamic styling using elem_id ---
195
  with gr.Blocks(title="Company Documents Q&A Chatbot", theme=gr.themes.Soft()) as demo:
196
  gr.Markdown("## 📚 **Company Policies Q&A Chatbot**")
197
-
198
  with gr.Row():
199
  with gr.Column(scale=3):
200
  question = gr.Textbox(
@@ -202,22 +202,24 @@ with gr.Blocks(title="Company Documents Q&A Chatbot", theme=gr.themes.Soft()) as
202
  placeholder="What are the conditions for permanent employment status?",
203
  lines=1,
204
  interactive=True,
205
- elem_id="user-question"
 
206
  )
207
  with gr.Column(scale=1):
208
  submit_btn = gr.Button("Submit", variant="primary", elem_id="submit-btn")
209
-
210
  with gr.Row():
211
  with gr.Column():
212
  chat_history = gr.Chatbot(
213
  label="Chat History",
214
  elem_id="chatbox",
215
- style="background-color: #ffffff; border-radius: 10px; padding: 20px; height: 400px; overflow-y: scroll;"
 
216
  )
217
- conf_out = gr.Markdown(label="Confidence")
218
- source_out = gr.Markdown(label="Source Link")
219
- record_out = gr.Markdown(label="Salesforce Record ID")
220
-
221
  submit_btn.click(fn=process_question, inputs=[question, chat_history], outputs=[chat_history, conf_out, source_out, record_out])
222
 
223
  demo.launch(server_name="0.0.0.0", server_port=7860, share=True)
 
194
  # --- Chatbot UI with dynamic styling using elem_id ---
195
  with gr.Blocks(title="Company Documents Q&A Chatbot", theme=gr.themes.Soft()) as demo:
196
  gr.Markdown("## 📚 **Company Policies Q&A Chatbot**")
197
+
198
  with gr.Row():
199
  with gr.Column(scale=3):
200
  question = gr.Textbox(
 
202
  placeholder="What are the conditions for permanent employment status?",
203
  lines=1,
204
  interactive=True,
205
+ elem_id="user-question",
206
+ visible=True
207
  )
208
  with gr.Column(scale=1):
209
  submit_btn = gr.Button("Submit", variant="primary", elem_id="submit-btn")
210
+
211
  with gr.Row():
212
  with gr.Column():
213
  chat_history = gr.Chatbot(
214
  label="Chat History",
215
  elem_id="chatbox",
216
+ height=400, # Set a fixed height
217
+ show_label=False # Hide the label to make the chat more clean
218
  )
219
+ conf_out = gr.Markdown(label="Confidence", elem_id="confidence")
220
+ source_out = gr.Markdown(label="Source Link", elem_id="source-link")
221
+ record_out = gr.Markdown(label="Salesforce Record ID", elem_id="salesforce-id")
222
+
223
  submit_btn.click(fn=process_question, inputs=[question, chat_history], outputs=[chat_history, conf_out, source_out, record_out])
224
 
225
  demo.launch(server_name="0.0.0.0", server_port=7860, share=True)