VenkateshRoshan commited on
Commit
c95a175
·
1 Parent(s): 54c3c16

memory usage added

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py CHANGED
@@ -90,6 +90,11 @@ class CustomerSupportBot:
90
 
91
  def create_chat_interface():
92
  bot = CustomerSupportBot(model_path="/app/models")
 
 
 
 
 
93
 
94
  def predict(message: str, history: List[Tuple[str, str]]) -> Tuple[str, List[Tuple[str, str]]]:
95
  if not message:
@@ -167,6 +172,20 @@ def create_chat_interface():
167
  # Add keyboard shortcut for submit
168
  msg.change(lambda x: gr.update(interactive=bool(x.strip())), inputs=[msg], outputs=[submit])
169
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
170
  return interface
171
 
172
  from flask import Flask, jsonify
 
90
 
91
  def create_chat_interface():
92
  bot = CustomerSupportBot(model_path="/app/models")
93
+
94
+ # Function to run initial query
95
+ def initial_query():
96
+ welcome_message = "Hello! I'm your customer support assistant. How can I help you today?"
97
+ return "", [(None, welcome_message)]
98
 
99
  def predict(message: str, history: List[Tuple[str, str]]) -> Tuple[str, List[Tuple[str, str]]]:
100
  if not message:
 
172
  # Add keyboard shortcut for submit
173
  msg.change(lambda x: gr.update(interactive=bool(x.strip())), inputs=[msg], outputs=[submit])
174
 
175
+ print("Interface created successfully.")
176
+
177
+ # call the initial query function
178
+ # run a query first how are you and predict the output
179
+ print(predict("How are you", []))
180
+
181
+ # run a command which checks the resource usage
182
+ print(f'Bot Resource Usage : {bot.monitor_resources()}')
183
+
184
+ # show full system usage
185
+ print(f'CPU Percentage : {psutil.cpu_percent()}')
186
+ print(f'RAM Usage : {psutil.virtual_memory()}')
187
+ print(f'Swap Memory : {psutil.swap_memory()}')
188
+
189
  return interface
190
 
191
  from flask import Flask, jsonify