ECUiVADE commited on
Commit
d576ff7
1 Parent(s): 62a7c65

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -62,7 +62,7 @@ YearsOfExp = ""
62
  chat_log_name =""
63
  status = ""
64
 
65
- agree_status = ""
66
 
67
  from llama_cpp import Llama
68
  llm = Llama(model_path=model_file, model_type="mistral",n_gpu_layers=-1,n_ctx = 2048)
@@ -154,7 +154,7 @@ def generate(prompt, history):
154
  global isFirstRun,initContext,Name,Occupation,Ethnicity,Gender,Age,context,YearsOfExp
155
 
156
  #if not len(Name) == 0 and not len(Occupation) == 0 and not len(Ethnicity) == 0 and not len(Gender) == 0 and not len(Age) == 0 and not len(YearsOfExp):
157
- if agree_status:
158
  firstmsg =""
159
  if isFirstRun:
160
  context = initContext
@@ -219,9 +219,10 @@ def submit_user_info(name,occupation,yearsofexp,ethnicity,gender,age):
219
  else:
220
  return "Enter ALL the details to start chatting"
221
 
222
- def start_chat_button():
223
 
224
  if agree_status:
 
225
  chat_log_name = f'chat_log_for_{unique_id}_{datetime.now().strftime("%Y-%m-%d_%H-%M-%S")}.json'
226
  return f"You can start chatting now"
227
  else:
@@ -270,7 +271,7 @@ with gr.Blocks() as app:
270
  agree_status = gr.Checkbox(label="I have read and understand the terms and conditions.")
271
  print(agree_status)
272
  #submit_info.click(submit_user_info, inputs=[name, occupation, yearsofexp, ethnicity, gender, age], outputs=[status_textbox])
273
- start_chat_button.click(submit_user_info, inputs=[], outputs=[status_textbox])
274
 
275
  with gr.Tab("Chat Bot"):
276
  chatbot = gr.Chatbot()
 
62
  chat_log_name =""
63
  status = ""
64
 
65
+ agreed = ""
66
 
67
  from llama_cpp import Llama
68
  llm = Llama(model_path=model_file, model_type="mistral",n_gpu_layers=-1,n_ctx = 2048)
 
154
  global isFirstRun,initContext,Name,Occupation,Ethnicity,Gender,Age,context,YearsOfExp
155
 
156
  #if not len(Name) == 0 and not len(Occupation) == 0 and not len(Ethnicity) == 0 and not len(Gender) == 0 and not len(Age) == 0 and not len(YearsOfExp):
157
+ if agreed:
158
  firstmsg =""
159
  if isFirstRun:
160
  context = initContext
 
219
  else:
220
  return "Enter ALL the details to start chatting"
221
 
222
+ def start_chat_button(agree_status):
223
 
224
  if agree_status:
225
+ agreed = agree_status
226
  chat_log_name = f'chat_log_for_{unique_id}_{datetime.now().strftime("%Y-%m-%d_%H-%M-%S")}.json'
227
  return f"You can start chatting now"
228
  else:
 
271
  agree_status = gr.Checkbox(label="I have read and understand the terms and conditions.")
272
  print(agree_status)
273
  #submit_info.click(submit_user_info, inputs=[name, occupation, yearsofexp, ethnicity, gender, age], outputs=[status_textbox])
274
+ start_chat_button.click(start_chat_button, inputs=[agree_status.value], outputs=[status_textbox])
275
 
276
  with gr.Tab("Chat Bot"):
277
  chatbot = gr.Chatbot()