AashitaK commited on
Commit
d32f2e5
·
verified ·
1 Parent(s): 6fb6ca2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -27
app.py CHANGED
@@ -49,34 +49,22 @@ if not all([title, description,
49
 
50
  # Define the chatbot function to handle user queries and generate responses
51
  def chatbot(query: str) -> str:
52
- # """
53
- # Function to handle the chatbot interaction.
54
- # :param query: The user query to respond to.
55
- # :return: The response text from the chatbot.
56
- # """
57
- # try:
58
- # if query.strip():
59
- # response = response_manager.create_response(query, model, temperature, max_output_tokens, max_num_results)
60
- # if not response:
61
- # return "Sorry, I couldn't generate a response at this time. Please try again later."
62
- # # Return the response from the AI model
63
- # return response
64
- # else:
65
- # return "Please enter a valid query."
66
- # except Exception as e:
67
- # return str(e)
68
-
69
- return """
70
- ## Test Response
71
- - **Bold text**
72
- - *Italic text*
73
- - `Inline code`
74
-
75
- ```python
76
- # Block code example
77
- print("Hello World")
78
- ```
79
  """
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
 
81
  # Create a Gradio GUI interface
82
  inputs = gr.Textbox(lines=7, label=chatbot_input_label, placeholder=chatbot_input_placeholder)
 
49
 
50
  # Define the chatbot function to handle user queries and generate responses
51
  def chatbot(query: str) -> str:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  """
53
+ Function to handle the chatbot interaction.
54
+ :param query: The user query to respond to.
55
+ :return: The response text from the chatbot.
56
+ """
57
+ try:
58
+ if query.strip():
59
+ response = response_manager.create_response(query, model, temperature, max_output_tokens, max_num_results)
60
+ if not response:
61
+ return "Sorry, I couldn't generate a response at this time. Please try again later."
62
+ # Return the response from the AI model
63
+ return response
64
+ else:
65
+ return "Please enter a valid query."
66
+ except Exception as e:
67
+ return str(e)
68
 
69
  # Create a Gradio GUI interface
70
  inputs = gr.Textbox(lines=7, label=chatbot_input_label, placeholder=chatbot_input_placeholder)