Venusumo commited on
Commit
ed96727
·
verified ·
1 Parent(s): 06fa61a

Update app.py

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