drmjh commited on
Commit
0cb166f
·
1 Parent(s): ee426d2
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -44,7 +44,8 @@ def load_config(request: gr.Request):
44
  survey_template = config['template']
45
  initial_message = config['initial_message']
46
  model_args = {'model': config['model'], 'temperature': config['temperature']}
47
- return survey_question, survey_template, initial_message, model_args
 
48
 
49
  # Post-loading
50
  def update_system_message(question: str, template: PromptTemplate | str) -> str:
@@ -87,10 +88,10 @@ def initialize_interview(
87
 
88
 
89
  def initialize_tracker(
90
- model_args: dict[str, str | float], question: str, template: PromptTemplate
91
  ):
92
  "Initializes wandb run for interview"
93
- run_config = model_args | {"question": question, "template": str(template)}
94
  wandb.init(project="cognitive-debrief", config=run_config, tags=["dev"])
95
 
96
 
@@ -183,6 +184,7 @@ with gr.Blocks() as demo:
183
  initialMessage = gr.Textbox(visible=False)
184
  systemMessage = gr.Textbox(visible=False)
185
  modelArgs = gr.State(value={"model": "", "temperature": ""})
 
186
 
187
  # Debugging
188
  # with gr.Accordion("Debugging Panel", open=False):
@@ -226,7 +228,7 @@ with gr.Blocks() as demo:
226
  startInterview,
227
  resetButton,
228
  ],
229
- ).then(initialize_tracker, inputs=[modelArgs, surveyQuestion, surveyTemplate])
230
 
231
  chatInput.submit(
232
  user_message,
 
44
  survey_template = config['template']
45
  initial_message = config['initial_message']
46
  model_args = {'model': config['model'], 'temperature': config['temperature']}
47
+ userid = config['userid']
48
+ return survey_question, survey_template, initial_message, model_args, userid
49
 
50
  # Post-loading
51
  def update_system_message(question: str, template: PromptTemplate | str) -> str:
 
88
 
89
 
90
  def initialize_tracker(
91
+ model_args: dict[str, str | float], question: str, template: PromptTemplate, userid=str
92
  ):
93
  "Initializes wandb run for interview"
94
+ run_config = model_args | {"question": question, "template": str(template), "userid": userid}
95
  wandb.init(project="cognitive-debrief", config=run_config, tags=["dev"])
96
 
97
 
 
184
  initialMessage = gr.Textbox(visible=False)
185
  systemMessage = gr.Textbox(visible=False)
186
  modelArgs = gr.State(value={"model": "", "temperature": ""})
187
+ userid = gr.Textbox(visible=False)
188
 
189
  # Debugging
190
  # with gr.Accordion("Debugging Panel", open=False):
 
228
  startInterview,
229
  resetButton,
230
  ],
231
+ ).then(initialize_tracker, inputs=[modelArgs, surveyQuestion, surveyTemplate, userid])
232
 
233
  chatInput.submit(
234
  user_message,