Venusumo commited on
Commit
a04d045
·
verified ·
1 Parent(s): 596484d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +55 -1
app.py CHANGED
@@ -351,6 +351,15 @@ Contact Number
351
  04274525546
352
  """
353
 
 
 
 
 
 
 
 
 
 
354
  def respond(
355
  message,
356
  history: list[tuple[str, str]],
@@ -383,6 +392,9 @@ def respond(
383
  response += token
384
  yield response
385
 
 
 
 
386
  """
387
  For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
388
  """
@@ -402,6 +414,48 @@ demo = gr.ChatInterface(
402
  ],
403
  )
404
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
405
 
406
  if __name__ == "__main__":
407
- demo.launch()
 
351
  04274525546
352
  """
353
 
354
+
355
+ suggested_questions = [
356
+ "What services do you offer?",
357
+ "Can you tell me about your web development process?",
358
+ "What is the cost for an e-commerce website?",
359
+ "How long does it take to develop a custom website?",
360
+ "Do you provide ongoing support and maintenance?",
361
+ ]
362
+
363
  def respond(
364
  message,
365
  history: list[tuple[str, str]],
 
392
  response += token
393
  yield response
394
 
395
+ def set_suggested_question(question, textbox):
396
+ textbox.value = question
397
+
398
  """
399
  For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
400
  """
 
414
  ],
415
  )
416
 
417
+ # Create an interface for suggested questions
418
+ suggested_questions_dropdown = gr.Dropdown(
419
+ choices=suggested_questions,
420
+ label="Suggested Questions",
421
+ interactive=True,
422
+ )
423
+
424
+ # Textbox for user to input their message
425
+ user_input = gr.Textbox(label="Your question here")
426
+
427
+ # Button to set the selected suggested question to the user input textbox
428
+ set_question_button = gr.Button("Set Suggested Question")
429
+
430
+ # Function to update the user input textbox with the selected suggested question
431
+ set_question_button.click(
432
+ set_suggested_question,
433
+ inputs=[suggested_questions_dropdown, user_input],
434
+ outputs=[user_input],
435
+ )
436
+
437
+ demo = gr.Blocks()
438
+
439
+ with demo:
440
+ gr.Markdown("# Airavath Technologies Chatbot")
441
+ suggested_questions_dropdown.render()
442
+ user_input.render()
443
+ set_question_button.render()
444
+ gr.ChatInterface(
445
+ respond,
446
+ additional_inputs=[
447
+ gr.Textbox(value=airavath_details, label="System message"),
448
+ gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
449
+ gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
450
+ gr.Slider(
451
+ minimum=0.1,
452
+ maximum=1.0,
453
+ value=0.95,
454
+ step=0.05,
455
+ label="Top-p (nucleus sampling)",
456
+ ),
457
+ ],
458
+ ).launch()
459
 
460
  if __name__ == "__main__":
461
+ demo.launch()