anushkaayadav commited on
Commit
afa953a
·
verified ·
1 Parent(s): 92501b7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -15
app.py CHANGED
@@ -6,7 +6,7 @@ import os
6
  os.environ["TOKENIZERS_PARALLELISM"] = "false"
7
 
8
  # Initialize paths and model identifiers for easy configuration and maintenance
9
- filename = "output_interior_details.txt" # Path to the file storing chess-specific details
10
  retrieval_model_name = 'output/sentence-transformer-finetuned/'
11
 
12
  openai.api_key = os.environ["OPENAI_API_KEY"]
@@ -60,11 +60,11 @@ def find_relevant_segment(user_query, segments):
60
 
61
  def generate_response(user_query, relevant_segment):
62
  """
63
- Generate a response emphasizing the bot's capability in providing chess information.
64
  """
65
  try:
66
- system_message = "You are a chess chatbot specialized in providing information on chess rules, strategies, and terminology."
67
- user_message = f"Here's the information on chess: {relevant_segment}"
68
  messages = [
69
  {"role": "system", "content": system_message},
70
  {"role": "user", "content": user_message}
@@ -88,7 +88,7 @@ def query_model(question):
88
  Process a question, find relevant information, and generate a response.
89
  """
90
  if question == "":
91
- return "Welcome to ChessBot! Ask me anything about chess rules, strategies, and terminology."
92
  relevant_segment = find_relevant_segment(question, segments)
93
  if not relevant_segment:
94
  return "Could not find specific information. Please refine your question."
@@ -97,20 +97,18 @@ def query_model(question):
97
 
98
  # Define the welcome message and specific topics the chatbot can provide information about
99
  welcome_message = """
100
- # ♟️ Welcome to ChessBot!
101
 
102
- ## Your AI-driven assistant for all chess-related queries. Created by SCHOLAR1, SCHOLAR2, and SCHOLAR3 of the 2024 Kode With Klossy CITY Camp.
103
  """
104
 
105
  topics = """
106
  ### Feel Free to ask me anything from the topics below!
107
- - Chess piece movements
108
- - Special moves
109
- - Game phases
110
- - Common strategies
111
- - Chess terminology
112
- - Famous games
113
- - Chess tactics
114
  """
115
 
116
  # Setup the Gradio Blocks interface with custom layout components
@@ -122,7 +120,7 @@ with gr.Blocks(theme='JohnSmith9982/small_and_pretty') as demo:
122
  with gr.Row():
123
  with gr.Column():
124
  question = gr.Textbox(label="Your question", placeholder="What do you want to ask about?")
125
- answer = gr.Textbox(label="ChessBot Response", placeholder="ChessBot will respond here...", interactive=False, lines=10)
126
  submit_button = gr.Button("Submit")
127
  submit_button.click(fn=query_model, inputs=question, outputs=answer)
128
 
 
6
  os.environ["TOKENIZERS_PARALLELISM"] = "false"
7
 
8
  # Initialize paths and model identifiers for easy configuration and maintenance
9
+ filename = "output_interior_details.txt" # Path to the file storing interior_design-specific details
10
  retrieval_model_name = 'output/sentence-transformer-finetuned/'
11
 
12
  openai.api_key = os.environ["OPENAI_API_KEY"]
 
60
 
61
  def generate_response(user_query, relevant_segment):
62
  """
63
+ Generate a response emphasizing the bot's capability in providing interior design information.
64
  """
65
  try:
66
+ system_message = "You are Tessy who is designed to help find interior design inspiration and guide the users transform their living space."
67
+ user_message = f"Here's the information on interior design: {relevant_segment}"
68
  messages = [
69
  {"role": "system", "content": system_message},
70
  {"role": "user", "content": user_message}
 
88
  Process a question, find relevant information, and generate a response.
89
  """
90
  if question == "":
91
+ return "Welcome to Designare! Ask me anything about different styles or inspiration for interior design."
92
  relevant_segment = find_relevant_segment(question, segments)
93
  if not relevant_segment:
94
  return "Could not find specific information. Please refine your question."
 
97
 
98
  # Define the welcome message and specific topics the chatbot can provide information about
99
  welcome_message = """
100
+ # ♟️ Welcome to Designare!
101
 
102
+ ## I am Tessy and I am here to help you with your interior design journey. Created by Anushka, Prani, Gigi, and Jewel of the 2024 Kode With Klossy St. Louis Camp.
103
  """
104
 
105
  topics = """
106
  ### Feel Free to ask me anything from the topics below!
107
+ - What is interior design
108
+ - Different asthetics
109
+ - Styles
110
+ - Inspiration
111
+ - Color guide
 
 
112
  """
113
 
114
  # Setup the Gradio Blocks interface with custom layout components
 
120
  with gr.Row():
121
  with gr.Column():
122
  question = gr.Textbox(label="Your question", placeholder="What do you want to ask about?")
123
+ answer = gr.Textbox(label="Tessy Response", placeholder="Tessy will respond here...", interactive=False, lines=10)
124
  submit_button = gr.Button("Submit")
125
  submit_button.click(fn=query_model, inputs=question, outputs=answer)
126