linx5o commited on
Commit
2a3b2a0
1 Parent(s): c92b425

global client

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -285,7 +285,9 @@ def void_client():
285
  client_custom = None
286
  print("Client disconnected")
287
 
288
- def stirring_default(rpm, experiment, state, client):
 
 
289
  if state == "start":
290
  payload = {
291
  "command": "start_stirring",
@@ -312,9 +314,11 @@ def stirring_default(rpm, experiment, state, client):
312
  else:
313
  print("Invalid state")
314
 
315
- def temp_automation_default(temperature, experiment, state, option, client):
316
  payload_options = "thermostat" if option == "Heat To Temp" else "only_record_temperature"
317
 
 
 
318
  if state == "start":
319
  payload = {
320
  "command": "set_temperature_automation",
@@ -375,7 +379,7 @@ with gr.Blocks() as demo:
375
 
376
  st.click(
377
  fn=stirring_default,
378
- inputs=[rpm, experiment_input, stir_state, client]
379
  )
380
 
381
  with gr.Blocks():
@@ -405,7 +409,7 @@ with gr.Blocks() as demo:
405
 
406
  temp.click(
407
  fn=temp_automation_default,
408
- inputs=[temperature_slider, experiment_input, temp_state, temp_option, client]
409
  )
410
 
411
 
 
285
  client_custom = None
286
  print("Client disconnected")
287
 
288
+ def stirring_default(rpm, experiment, state):
289
+ global client
290
+
291
  if state == "start":
292
  payload = {
293
  "command": "start_stirring",
 
314
  else:
315
  print("Invalid state")
316
 
317
+ def temp_automation_default(temperature, experiment, state, option):
318
  payload_options = "thermostat" if option == "Heat To Temp" else "only_record_temperature"
319
 
320
+ global client
321
+
322
  if state == "start":
323
  payload = {
324
  "command": "set_temperature_automation",
 
379
 
380
  st.click(
381
  fn=stirring_default,
382
+ inputs=[rpm, experiment_input, stir_state]
383
  )
384
 
385
  with gr.Blocks():
 
409
 
410
  temp.click(
411
  fn=temp_automation_default,
412
+ inputs=[temperature_slider, experiment_input, temp_state, temp_option]
413
  )
414
 
415