gursi26 commited on
Commit
5ae52c5
·
1 Parent(s): 4652dbc

revert to prev code

Browse files
Files changed (1) hide show
  1. app.py +10 -13
app.py CHANGED
@@ -111,26 +111,23 @@ elif st.session_state.selected_command == "control/gripper":
111
  speed = st.slider("Speed", 1, 100, 50)
112
  args = {"gripper_value": gripper_value, "speed": speed}
113
 
114
- if "client" not in st.session_state:
115
- st.session_state.client = create_paho_client()
116
- setup_paho_client(
117
- st.session_state.client,
118
- HIVEMQ_USERNAME,
119
- HIVEMQ_PASSWORD,
120
- HIVEMQ_HOST,
121
- PORT,
122
- DEVICE_ID
123
- )
124
- st.session_state.client.loop_start()
125
-
126
  with st.form("mqtt_form"):
127
  if st.form_submit_button("Send Command"):
 
 
 
 
 
 
 
 
 
128
 
129
  payload = {"command": st.session_state.selected_command, "args": args}
130
  st.markdown("### Payload")
131
  st.write(payload)
132
 
133
- response = publish_and_wait(st.session_state.client, DEVICE_ID, payload)
134
  st.markdown("### Response")
135
  if response is not None:
136
  if "image" in response:
 
111
  speed = st.slider("Speed", 1, 100, 50)
112
  args = {"gripper_value": gripper_value, "speed": speed}
113
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  with st.form("mqtt_form"):
115
  if st.form_submit_button("Send Command"):
116
+ client = create_paho_client()
117
+ setup_paho_client(
118
+ client,
119
+ HIVEMQ_USERNAME,
120
+ HIVEMQ_PASSWORD,
121
+ HIVEMQ_HOST,
122
+ PORT,
123
+ DEVICE_ID
124
+ )
125
 
126
  payload = {"command": st.session_state.selected_command, "args": args}
127
  st.markdown("### Payload")
128
  st.write(payload)
129
 
130
+ response = publish_and_wait(client, DEVICE_ID, payload)
131
  st.markdown("### Response")
132
  if response is not None:
133
  if "image" in response: