taratrankennedy commited on
Commit
a0371ce
β€’
1 Parent(s): 4e866af

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -30
app.py CHANGED
@@ -65,7 +65,7 @@ def generate_response(user_query, relevant_segment):
65
  Generate a response emphasizing the bot's capability in providing country-specific visa information.
66
  """
67
  try:
68
- system_message = "You are a visa chatbot specialized in providing country-specific visa requirement information."
69
  user_message = f"Here's the information on visa requirements for your query: {relevant_segment}"
70
  messages = [
71
  {"role": "system", "content": system_message},
@@ -92,13 +92,13 @@ def generate_response(user_query, relevant_segment):
92
  # Define and configure the Gradio application interface to interact with users.
93
  def query_model(question):
94
  """
95
- Process a question, find relevant information, and generate a response, specifically for U.S. visa questions.
96
  """
97
  if question == "":
98
- return "Welcome to VisaBot! Ask me anything about U.S. visa processes."
99
  relevant_segment = find_relevant_segment(question, segments)
100
  if not relevant_segment:
101
- return "Could not find U.S.-specific information. Please refine your question."
102
  response = generate_response(question, relevant_segment)
103
  return response
104
 
@@ -107,38 +107,23 @@ def query_model(question):
107
 
108
  # Define the welcome message and specific topics and countries the chatbot can provide information about.
109
  welcome_message = """
110
- # Welcome to VISABOT!
 
111
 
112
- ## Your AI-driven visa assistant for all travel-related queries.
113
  """
114
 
115
  topics = """
116
  ### Feel Free to ask me anything from the topics below!
117
- - Visa issuance
118
- - Documents needed
119
- - Application process
120
- - Processing time
121
- - Recommended Vaccines
122
- - Health Risks
123
- - Healthcare Facilities
124
- - Currency Information
125
- - Embassy Information
126
- - Allowed stay
127
  """
128
 
129
- countries = """
130
- ### Our chatbot can currently answer questions for these countries!
131
- - πŸ‡¨πŸ‡³ China
132
- - πŸ‡«πŸ‡· France
133
- - πŸ‡¬πŸ‡Ή Guatemala
134
- - πŸ‡±πŸ‡§ Lebanon
135
- - πŸ‡²πŸ‡½ Mexico
136
- - πŸ‡΅πŸ‡­ Philippines
137
- - πŸ‡·πŸ‡Έ Serbia
138
- - πŸ‡ΈπŸ‡± Sierra Leone
139
- - πŸ‡ΏπŸ‡¦ South Africa
140
- - πŸ‡»πŸ‡³ Vietnam
141
- """
142
 
143
  # Define and configure the Gradio application interface to interact with users.
144
  def query_model(question):
@@ -173,7 +158,7 @@ with gr.Blocks() as demo:
173
  with gr.Row():
174
  with gr.Column():
175
  question = gr.Textbox(label="Your question", placeholder="What do you want to ask about?")
176
- answer = gr.Textbox(label="VisaBot Response", placeholder="VisaBot will respond here...", interactive=False, lines=10)
177
  submit_button = gr.Button("Submit")
178
  submit_button.click(fn=query_model, inputs=question, outputs=answer)
179
 
 
65
  Generate a response emphasizing the bot's capability in providing country-specific visa information.
66
  """
67
  try:
68
+ system_message = "You are a chess chatbot specialized in providing information on chess rules, strategies, and terminology."
69
  user_message = f"Here's the information on visa requirements for your query: {relevant_segment}"
70
  messages = [
71
  {"role": "system", "content": system_message},
 
92
  # Define and configure the Gradio application interface to interact with users.
93
  def query_model(question):
94
  """
95
+ Process a question, find relevant information, and generate a response.
96
  """
97
  if question == "":
98
+ return "Welcome to ChessBot! Ask me anything about chess rules, strategies, and terminology."
99
  relevant_segment = find_relevant_segment(question, segments)
100
  if not relevant_segment:
101
+ return "Could not find specific information. Please refine your question."
102
  response = generate_response(question, relevant_segment)
103
  return response
104
 
 
107
 
108
  # Define the welcome message and specific topics and countries the chatbot can provide information about.
109
  welcome_message = """
110
+ welcome_message = """
111
+ # Welcome to ChessBot!
112
 
113
+ ## Your AI-driven assistant for all chess-related queries.
114
  """
115
 
116
  topics = """
117
  ### Feel Free to ask me anything from the topics below!
118
+ - Chess piece movements
119
+ - Special moves
120
+ - Game phases
121
+ - Common strategies
122
+ - Chess terminology
123
+ - Famous games
124
+ - Chess tactics
 
 
 
125
  """
126
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
 
128
  # Define and configure the Gradio application interface to interact with users.
129
  def query_model(question):
 
158
  with gr.Row():
159
  with gr.Column():
160
  question = gr.Textbox(label="Your question", placeholder="What do you want to ask about?")
161
+ answer = gr.Textbox(label="ChessBot Response", placeholder="ChessBot will respond here...", interactive=False, lines=10)
162
  submit_button = gr.Button("Submit")
163
  submit_button.click(fn=query_model, inputs=question, outputs=answer)
164