Spaces:
Runtime error
Runtime error
testing
Browse files
app.py
CHANGED
|
@@ -24,6 +24,7 @@ def on_connect(client, userdata, flags, rc):
|
|
| 24 |
print("Connected with result code "+str(rc))
|
| 25 |
|
| 26 |
def create_client(host, port, username, password):
|
|
|
|
| 27 |
client = mqtt.Client()
|
| 28 |
client.username_pw_set(username, password)
|
| 29 |
client.tls_set(tls_version=mqtt.ssl.PROTOCOL_TLS)
|
|
@@ -83,7 +84,7 @@ def stirring(rpm, host, port, username, password, pioreactor, experiment, state)
|
|
| 83 |
client_custom.publish(f"pioreactor/control", json.dumps(payload))
|
| 84 |
elif state == "update":
|
| 85 |
payload = {
|
| 86 |
-
"command": "
|
| 87 |
"experiment": experiment,
|
| 88 |
"reactor": pioreactor,
|
| 89 |
"rpm": rpm
|
|
@@ -288,6 +289,7 @@ def void_client():
|
|
| 288 |
if client_custom is not None:
|
| 289 |
client_custom.disconnect()
|
| 290 |
client_custom = None
|
|
|
|
| 291 |
|
| 292 |
# Define the interface components
|
| 293 |
with gr.Blocks() as demo:
|
|
|
|
| 24 |
print("Connected with result code "+str(rc))
|
| 25 |
|
| 26 |
def create_client(host, port, username, password):
|
| 27 |
+
print(host, port, username, password)
|
| 28 |
client = mqtt.Client()
|
| 29 |
client.username_pw_set(username, password)
|
| 30 |
client.tls_set(tls_version=mqtt.ssl.PROTOCOL_TLS)
|
|
|
|
| 84 |
client_custom.publish(f"pioreactor/control", json.dumps(payload))
|
| 85 |
elif state == "update":
|
| 86 |
payload = {
|
| 87 |
+
"command": "update_stirring_rpm",
|
| 88 |
"experiment": experiment,
|
| 89 |
"reactor": pioreactor,
|
| 90 |
"rpm": rpm
|
|
|
|
| 289 |
if client_custom is not None:
|
| 290 |
client_custom.disconnect()
|
| 291 |
client_custom = None
|
| 292 |
+
print("Client disconnected")
|
| 293 |
|
| 294 |
# Define the interface components
|
| 295 |
with gr.Blocks() as demo:
|