gursi26 commited on
Commit
ba08b5d
1 Parent(s): f48c8a8

checkpoint

Browse files
Files changed (1) hide show
  1. app.py +324 -239
app.py CHANGED
@@ -1,244 +1,329 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  # import gradio as gr
2
- # from client import CobotController
3
- # from utils import get_credentials
4
- # import json
5
-
6
- # options = [
7
- # "query/angles", "query/coords", "query/gripper", "query/camera",
8
- # "control/angles", "control/coords", "control/gripper"
9
- # ]
10
-
11
- # with gr.Blocks() as app:
12
- # user, pwd, host, endpoint, port = get_credentials(False)
13
- # client = CobotController(user, pwd, host, port, endpoint)
14
-
15
- # def handle_request(
16
- # selected_command, angle1=0.0, angle2=0.0, angle3=0.0, angle4=0.0,
17
- # angle5=0.0, angle6=0.0, coord1=0.0, coord2=0.0, coord3=0.0, coord4=0.0,
18
- # coord5=0.0, coord6=0.0, gripper_value=0.0, speed_angles=0.0, speed_coords=0.0,
19
- # speed_gripper=0.0
20
- # ):
21
- # img = None
22
- # if selected_command == "query/angles":
23
- # response = client.get_angles()
24
- # elif selected_command == "query/coords":
25
- # response = client.get_coords()
26
- # elif selected_command == "query/gripper":
27
- # response = client.get_gripper_value()
28
- # elif selected_command == "query/camera":
29
- # response = client.get_camera()
30
- # img = response.pop("image")
31
- # elif selected_command == "control/angles":
32
- # response = client.send_angles(
33
- # angle_list = [angle1, angle2, angle3, angle4, angle5, angle6],
34
- # speed = speed_angles
35
- # )
36
- # elif selected_command == "control/coords":
37
- # response = client.send_coords(
38
- # angle_list = [coord1, coord2, coord3, coord4, coord5, coord6],
39
- # speed = speed_coords
40
- # )
41
- # elif selected_command == "control/gripper":
42
- # response = client.send_gripper_value(
43
- # value = gripper_value,
44
- # speed = speed_gripper
45
- # )
46
-
47
- # text_output = json.dumps(response, indent=4)
48
- # if img is not None:
49
- # return text_output, gr.update(value=img, visible=True)
50
- # return text_output, None
51
-
52
- # gr.Markdown("# MyCobot 280pi MQTT Control demo")
53
- # gr.Markdown("This is a public demo of the MyCobot 280pi...")
54
-
55
- # selected_command = gr.Dropdown(choices=options, label="Select command")
56
-
57
- # with gr.Group(visible=False) as query_angles_group:
58
- # pass
59
-
60
- # with gr.Group(visible=False) as query_coords_group:
61
- # pass
62
-
63
- # with gr.Group(visible=False) as query_camera_group:
64
- # pass
65
-
66
- # with gr.Group(visible=False) as query_gripper_group:
67
- # pass
68
-
69
- # with gr.Group(visible=False) as control_angles_group:
70
- # angle1 = gr.Number(value=0.0, label="Angle 1", step=5.0)
71
- # angle2 = gr.Number(value=0.0, label="Angle 2", step=5.0)
72
- # angle3 = gr.Number(value=0.0, label="Angle 3", step=5.0)
73
- # angle4 = gr.Number(value=0.0, label="Angle 4", step=5.0)
74
- # angle5 = gr.Number(value=0.0, label="Angle 5", step=5.0)
75
- # angle6 = gr.Number(value=0.0, label="Angle 6", step=5.0)
76
- # speed_angles = gr.Slider(value=50.0, minimum=0.0, maximum=100.0, step=1.0, label="Speed")
77
-
78
- # with gr.Group(visible=False) as control_coords_group:
79
- # coord1 = gr.Number(value=0.0, label="X coordinate", step=5.0)
80
- # coord2 = gr.Number(value=0.0, label="Y coordinate", step=5.0)
81
- # coord3 = gr.Number(value=0.0, label="Z coordinate", step=5.0)
82
- # coord4 = gr.Number(value=0.0, label="Rotation X", step=5.0)
83
- # coord5 = gr.Number(value=0.0, label="Rotation Y", step=5.0)
84
- # coord6 = gr.Number(value=0.0, label="Rotation Z", step=5.0)
85
- # speed_coords = gr.Slider(value=50.0, minimum=0.0, maximum=100.0, step=1.0, label="Speed")
86
-
87
- # with gr.Group(visible=False) as control_gripper_group:
88
- # gripper_value = gr.Slider(minimum=0.0, maximum=100.0, step=1.0, label="Gripper value")
89
- # speed_gripper = gr.Slider(value=50.0, minimum=0.0, maximum=100.0, step=1.0, label="Speed")
90
-
91
- # def toggle_visibility(command):
92
- # return (
93
- # gr.update(visible=command == "query/angles"),
94
- # gr.update(visible=command == "query/coords"),
95
- # gr.update(visible=command == "query/camera"),
96
- # gr.update(visible=command == "query/gripper"),
97
- # gr.update(visible=command == "control/angles"),
98
- # gr.update(visible=command == "control/coords"),
99
- # gr.update(visible=command == "control/gripper"),
100
- # gr.update(visible=False),
101
- # gr.update(value="")
102
- # )
103
-
104
- # submit_button = gr.Button("Send Command")
105
- # output_text = gr.Textbox(label="")
106
- # output_image = gr.Image(visible=False)
107
-
108
- # selected_command.change(
109
- # toggle_visibility,
110
- # selected_command,
111
- # [
112
- # query_angles_group, query_coords_group, query_camera_group, query_gripper_group,
113
- # control_angles_group, control_coords_group, control_gripper_group, output_image,
114
- # output_text
115
- # ]
 
116
  # )
117
 
118
- # submit_button.click(
119
- # handle_request,
120
- # inputs=[selected_command, angle1, angle2, angle3, angle4, angle5, angle6,
121
- # coord1, coord2, coord3, coord4, coord5, coord6, gripper_value, speed_angles,
122
- # speed_coords, speed_gripper],
123
- # outputs=[output_text, output_image],
124
- # concurrency_id="single_user",
125
- # concurrency_limit=1
126
  # )
127
 
128
- # app.queue(default_concurrency_limit=1, max_size=100)
129
- # app.launch()
130
- import gradio as gr
131
- from collections import deque
132
- import threading
133
- import time
134
-
135
- SESSION_TIME = 30
136
-
137
- class QueueSystem:
138
- def __init__(self):
139
- self.queue = deque()
140
- self.current_user = None
141
- self.session_start_time = None
142
- self.lock = threading.Lock()
143
-
144
- def enqueue_user(self, user_id):
145
- with self.lock:
146
- if user_id not in self.queue and user_id != self.current_user:
147
- self.queue.append(user_id)
148
-
149
- def dequeue_user(self):
150
- with self.lock:
151
- if self.queue:
152
- return self.queue.popleft()
153
- return None
154
-
155
- def get_queue_info(self, user_id):
156
- with self.lock:
157
- if user_id == self.current_user:
158
- remaining_time = max(0, SESSION_TIME - (time.time() - self.session_start_time))
159
- return 0, remaining_time
160
- elif user_id in self.queue:
161
- position = list(self.queue).index(user_id) + 1
162
- wait_time = (position - 1) * SESSION_TIME + max(0, SESSION_TIME - (time.time() - self.session_start_time))
163
- return position, wait_time
164
- else:
165
- return None, None
166
-
167
- def start_session(self, user_id):
168
- with self.lock:
169
- if self.current_user is None:
170
- self.current_user = user_id
171
- self.session_start_time = time.time()
172
- return True
173
- return False
174
-
175
- def end_session(self):
176
- with self.lock:
177
- if self.current_user and time.time() - self.session_start_time >= SESSION_TIME:
178
- self.current_user = None
179
- self.session_start_time = None
180
- return True
181
- return False
182
-
183
- queue_system = QueueSystem()
184
-
185
- def process_input(input_text, user_id):
186
- update_queue()
187
- if queue_system.current_user is None:
188
- queue_system.start_session(user_id)
189
-
190
- queue_system.enqueue_user(user_id)
191
- position, wait_time = queue_system.get_queue_info(user_id)
192
-
193
- if position == 0: # User is currently being served
194
- result = f"Processed: {input_text}"
195
- remaining_time = wait_time
196
- return result, f"Your turn! Time remaining: {remaining_time:.0f} seconds."
197
- elif position is not None:
198
- return None, f"You are in position {position}. Estimated wait time: {wait_time:.0f} seconds."
199
- else:
200
- return None, "Error: You are not in the queue."
201
-
202
- def update_queue():
203
- if queue_system.end_session():
204
- next_user = queue_system.dequeue_user()
205
- if next_user:
206
- queue_system.start_session(next_user)
207
-
208
- def gradio_function(input_text, user_id):
209
- result, status = process_input(input_text, user_id)
210
- return result, status
211
-
212
- def get_queue_status(user_id):
213
- update_queue()
214
- if not user_id:
215
- return "Enter a User ID and submit to join the queue."
216
- position, wait_time = queue_system.get_queue_info(user_id)
217
- if position == 0:
218
- return f"Your turn! Time remaining: {wait_time:.0f} seconds."
219
- elif position is not None:
220
- return f"You are in position {position}. Estimated wait time: {wait_time:.0f} seconds."
221
- else:
222
- return "You are not in the queue. Submit to join."
223
-
224
- with gr.Blocks() as demo:
225
- input_text = gr.Textbox(label="Input")
226
- user_id = gr.Textbox(label="User ID")
227
- output_text = gr.Textbox(label="Output")
228
- status_text = gr.Markdown("Enter a User ID and submit to join the queue.")
229
- submit_btn = gr.Button("Submit")
230
-
231
- submit_btn.click(
232
- fn=gradio_function,
233
- inputs=[input_text, user_id],
234
- outputs=[output_text, status_text]
235
- )
236
-
237
- demo.load(
238
- fn=get_queue_status,
239
- inputs=user_id,
240
- outputs=status_text,
241
- )
242
-
243
- demo.queue(default_concurrency_limit=1, max_size=100)
244
- demo.launch()
 
1
+ import gradio as gr
2
+ from client import CobotController
3
+ from utils import get_credentials
4
+ from typing import Any
5
+ import json
6
+
7
+ user, pwd, host, endpoint, port = get_credentials(False)
8
+ client = CobotController(user, pwd, host, port, endpoint)
9
+
10
+ CSS = """
11
+ #col {
12
+ background-color: #161624;
13
+ padding: 16px;
14
+ border-radius: 8px;
15
+ }
16
+ #nogaprow {
17
+ gap: 0px !important;
18
+ }
19
+ #nogapcol {
20
+ padding: 0px !important;
21
+ border: none !important; /* Removes the border around each column */
22
+ box-shadow: none !important;
23
+ }
24
+ """
25
+
26
+ def handle_request(
27
+ command, gripper_value, gripper_speed, angle1, angle2, angle3, angle4,
28
+ angle5, angle6, angle_speed, xcoord, ycoord, zcoord, roll, pitch, yaw, coord_speed,
29
+ ):
30
+ if command == "query/angles":
31
+ resp = client.get_angles()
32
+ resp["command"] = command
33
+ return json.dumps(resp, indent=4), gr.Image(visible=False)
34
+ elif command == "query/coords":
35
+ resp = client.get_coords()
36
+ resp["command"] = command
37
+ return json.dumps(resp, indent=4), gr.Image(visible=False)
38
+ elif command == "query/camera":
39
+ resp = client.get_camera()
40
+ resp["command"] = command
41
+ if not resp["success"]:
42
+ return json.dumps(resp, indent=4)
43
+ img = resp.pop("image")
44
+ return json.dumps(resp, indent=4), gr.Image(visible=True, value=img)
45
+ elif command == "query/gripper":
46
+ resp = client.get_gripper_value()
47
+ resp["command"] = command
48
+ return json.dumps(resp, indent=4), gr.Image(visible=False)
49
+ elif command == "control/angles":
50
+ resp = client.send_angles(
51
+ angle_list = [angle1, angle2, angle3, angle4, angle5, angle6],
52
+ speed = angle_speed
53
+ )
54
+ resp["command"] = command
55
+ return json.dumps(resp, indent=4), gr.Image(visible=False)
56
+ elif command == "control/gripper":
57
+ resp = client.send_gripper_value(
58
+ value = gripper_value,
59
+ speed = gripper_speed
60
+ )
61
+ resp["command"] = command
62
+ return json.dumps(resp, indent=4), gr.Image(visible=False)
63
+ elif command == "control/coords":
64
+ resp = client.send_coords(
65
+ coord_list = [xcoord, ycoord, zcoord, roll, pitch, yaw],
66
+ speed = coord_speed
67
+ )
68
+ resp["command"] = command
69
+ return json.dumps(resp, indent=4), gr.Image(visible=False)
70
+
71
+ with gr.Blocks(css=CSS) as app:
72
+ gr.Markdown("# MyCobot 280pi MQTT Control Demo")
73
+ gr.Markdown("This is a demo that uses the MQTT protocol to communicate with the MyCobot 280pi over the internet. You can remotely send commands to the cobot and query it's current status.")
74
+
75
+ user_id = gr.Textbox(label="User ID", info="Enter a unique user id of your choice. This user id will be placed into a queue to give you access to the cobot, so make sure you remember it!")
76
+
77
+ with gr.Row():
78
+ # QUERY PANEL
79
+ with gr.Column(elem_id="col"):
80
+ gr.Markdown("## Query")
81
+ gr.Markdown("Use buttons on this panel to query the current status of the cobot, including information like joint angles, coordinates, gripper state and what the onboard camera sees.")
82
+ angle_query_button = gr.Button("Query Angles")
83
+ coord_query_button = gr.Button("Query Coordinates")
84
+ gripper_query_button = gr.Button("Query Gripper state")
85
+ camera_query_button = gr.Button("Query Camera")
86
+
87
+ # GRIPPER PANEL
88
+ with gr.Column(elem_id="col"):
89
+ gr.Markdown("## Gripper Control")
90
+ gr.Markdown("Use this panel to control the gripper of the cobot.")
91
+ gripper_value = gr.Slider(minimum=0.0, maximum=100.0, step=1.0, label="Gripper value", info="0 = gripper fully closed, 100 = gripper fully open")
92
+ speed_gripper = gr.Slider(value=50.0, minimum=0.0, maximum=100.0, step=1.0, label="Movement speed")
93
+ gripper_control_button = gr.Button("Send gripper command")
94
+
95
+ with gr.Row():
96
+ # ANGLE PANEL
97
+ with gr.Column(elem_id="col"):
98
+ gr.Markdown("## Angle Control")
99
+ gr.Markdown("Use this panel to control the joint angles of the cobot. Each angle corresponds to one of the 6 joints on the cobot.")
100
+ with gr.Row(elem_id="nogaprow"):
101
+ with gr.Column(elem_id="nogapcol"):
102
+ angle1 = gr.Number(value=0.0, label="Angle 1", step=5.0)
103
+ angle3 = gr.Number(value=0.0, label="Angle 3", step=5.0)
104
+ angle5 = gr.Number(value=0.0, label="Angle 5", step=5.0)
105
+ with gr.Column(elem_id="nogapcol"):
106
+ angle2 = gr.Number(value=0.0, label="Angle 2", step=5.0)
107
+ angle4 = gr.Number(value=0.0, label="Angle 4", step=5.0)
108
+ angle6 = gr.Number(value=0.0, label="Angle 6", step=5.0)
109
+ speed_angles = gr.Slider(value=50.0, minimum=0.0, maximum=100.0, step=1.0, label="Movement speed")
110
+ angle_control_button = gr.Button("Send angle command")
111
+
112
+ # COORD PANEL
113
+ with gr.Column(elem_id="col"):
114
+ gr.Markdown("## Coordinate Control")
115
+ gr.Markdown("Use this panel to control the joint coordinates of the cobot head. The angles are in [6-DoF format](https://en.wikipedia.org/wiki/Six_degrees_of_freedom).")
116
+ with gr.Row(elem_id="nogaprow"):
117
+ with gr.Column(elem_id="nogapcol"):
118
+ xcoord = gr.Number(value=0.0, label="X coordinate", step=5.0)
119
+ ycoord = gr.Number(value=0.0, label="Y coordinate", step=5.0)
120
+ zcoord = gr.Number(value=0.0, label="Z coordinate", step=5.0)
121
+ with gr.Column(elem_id="nogapcol"):
122
+ roll = gr.Number(value=0.0, label="Roll", step=5.0)
123
+ pitch = gr.Number(value=0.0, label="Pitch", step=5.0)
124
+ yaw = gr.Number(value=0.0, label="Yaw", step=5.0)
125
+ speed_coords = gr.Slider(value=50.0, minimum=0.0, maximum=100.0, step=1.0, label="Movement speed")
126
+ coord_control_button = gr.Button("Send coordinate command")
127
+
128
+ response = gr.Textbox(label="Response")
129
+ response_image = gr.Image(visible=False)
130
+
131
+ angle_query_button.click(
132
+ handle_request,
133
+ inputs = [
134
+ gr.Textbox(value="query/angles", visible=False),
135
+ gripper_value, speed_gripper, angle1, angle2, angle3, angle4,
136
+ angle5, angle6, speed_angles, xcoord, ycoord, zcoord, roll, pitch,
137
+ yaw, speed_coords
138
+ ],
139
+ outputs = [response, response_image]
140
+ )
141
+ coord_query_button.click(
142
+ handle_request,
143
+ inputs = [
144
+ gr.Textbox(value="query/coords", visible=False),
145
+ gripper_value, speed_gripper, angle1, angle2, angle3, angle4,
146
+ angle5, angle6, speed_angles, xcoord, ycoord, zcoord, roll, pitch,
147
+ yaw, speed_coords
148
+ ],
149
+ outputs = [response, response_image]
150
+ )
151
+ gripper_query_button.click(
152
+ handle_request,
153
+ inputs = [
154
+ gr.Textbox(value="query/gripper", visible=False),
155
+ gripper_value, speed_gripper, angle1, angle2, angle3, angle4,
156
+ angle5, angle6, speed_angles, xcoord, ycoord, zcoord, roll, pitch,
157
+ yaw, speed_coords
158
+ ],
159
+ outputs = [response, response_image]
160
+ )
161
+ camera_query_button.click(
162
+ handle_request,
163
+ inputs = [
164
+ gr.Textbox(value="query/camera", visible=False),
165
+ gripper_value, speed_gripper, angle1, angle2, angle3, angle4,
166
+ angle5, angle6, speed_angles, xcoord, ycoord, zcoord, roll, pitch,
167
+ yaw, speed_coords
168
+ ],
169
+ outputs = [response, response_image]
170
+ )
171
+ gripper_control_button.click(
172
+ handle_request,
173
+ inputs = [
174
+ gr.Textbox(value="control/gripper", visible=False),
175
+ gripper_value, speed_gripper, angle1, angle2, angle3, angle4,
176
+ angle5, angle6, speed_angles, xcoord, ycoord, zcoord, roll, pitch,
177
+ yaw, speed_coords
178
+ ],
179
+ outputs = [response, response_image]
180
+ )
181
+ angle_control_button.click(
182
+ handle_request,
183
+ inputs = [
184
+ gr.Textbox(value="control/angles", visible=False),
185
+ gripper_value, speed_gripper, angle1, angle2, angle3, angle4,
186
+ angle5, angle6, speed_angles, xcoord, ycoord, zcoord, roll, pitch,
187
+ yaw, speed_coords
188
+ ],
189
+ outputs = [response, response_image]
190
+ )
191
+ coord_control_button.click(
192
+ handle_request,
193
+ inputs = [
194
+ gr.Textbox(value="control/coords", visible=False),
195
+ gripper_value, speed_gripper, angle1, angle2, angle3, angle4,
196
+ angle5, angle6, speed_angles, xcoord, ycoord, zcoord, roll, pitch,
197
+ yaw, speed_coords
198
+ ],
199
+ outputs = [response, response_image]
200
+ )
201
+
202
+ app.launch()
203
+
204
  # import gradio as gr
205
+ # from collections import deque
206
+ # import threading
207
+ # import time
208
+
209
+ # SESSION_TIME = 30
210
+
211
+ # class QueueSystem:
212
+ # def __init__(self):
213
+ # self.queue = deque()
214
+ # self.current_user = None
215
+ # self.session_start_time = None
216
+ # self.lock = threading.Lock()
217
+
218
+ # def enqueue_user(self, user_id):
219
+ # with self.lock:
220
+ # if user_id not in self.queue and user_id != self.current_user:
221
+ # self.queue.append(user_id)
222
+
223
+ # def dequeue_user(self):
224
+ # with self.lock:
225
+ # if self.queue:
226
+ # return self.queue.popleft()
227
+ # return None
228
+
229
+ # def get_queue_info(self, user_id):
230
+ # with self.lock:
231
+ # if user_id == self.current_user:
232
+ # # Calculate remaining time for the current user
233
+ # remaining_time = max(0, SESSION_TIME - (time.time() - self.session_start_time))
234
+ # return 0, remaining_time
235
+ # elif user_id in self.queue:
236
+ # # Calculate wait time based on the queue position
237
+ # position = list(self.queue).index(user_id) + 1
238
+ # if self.session_start_time:
239
+ # # Use the current session time to calculate wait time
240
+ # wait_time = (position - 1) * SESSION_TIME + max(0, SESSION_TIME - (time.time() - self.session_start_time))
241
+ # else:
242
+ # # If no session is active, assume each user gets the full session time
243
+ # wait_time = position * SESSION_TIME
244
+ # return position, wait_time
245
+ # else:
246
+ # return None, None
247
+
248
+ # def start_session(self, user_id):
249
+ # with self.lock:
250
+ # if self.current_user is None:
251
+ # self.current_user = user_id
252
+ # self.session_start_time = time.time()
253
+ # return True
254
+ # return False
255
+
256
+ # def end_session(self):
257
+ # with self.lock:
258
+ # if self.current_user and time.time() - self.session_start_time >= SESSION_TIME:
259
+ # self.current_user = None
260
+ # self.session_start_time = None
261
+ # return True
262
+ # return False
263
+
264
+ # queue_system = QueueSystem()
265
+
266
+ # def process_input(input_text, user_id):
267
+ # if queue_system.current_user is None:
268
+ # queue_system.start_session(user_id)
269
+ # queue_system.enqueue_user(user_id)
270
+ # position, wait_time = queue_system.get_queue_info(user_id)
271
+
272
+ # if position == 0: # User is currently being served
273
+ # result = f"Processed: {input_text}"
274
+ # remaining_time = wait_time
275
+ # return result, f"Your turn! Time remaining: {remaining_time:.0f} seconds."
276
+ # elif position is not None:
277
+ # return None, f"You are in position {position}. Estimated wait time: {wait_time:.0f} seconds."
278
+ # else:
279
+ # return None, "Error: You are not in the queue."
280
+
281
+
282
+ # def gradio_function(input_text, user_id):
283
+ # result, status = process_input(input_text, user_id)
284
+ # return result, status
285
+
286
+ # def get_queue_status(user_id):
287
+ # if not user_id:
288
+ # return "Enter a User ID and submit to join the queue."
289
+ # position, wait_time = queue_system.get_queue_info(user_id)
290
+ # if position == 0:
291
+ # return f"Your turn! Time remaining: {wait_time:.0f} seconds."
292
+ # elif position is not None:
293
+ # return f"You are in position {position}. Estimated wait time: {wait_time:.0f} seconds."
294
+ # else:
295
+ # return "You are not in the queue. Submit to join."
296
+
297
+ # def background_timer():
298
+ # while True:
299
+ # time.sleep(1)
300
+ # if queue_system.end_session():
301
+ # next_user = queue_system.dequeue_user()
302
+ # if next_user:
303
+ # queue_system.start_session(next_user)
304
+
305
+ # # Start the background timer thread
306
+ # timer_thread = threading.Thread(target=background_timer, daemon=True)
307
+ # timer_thread.start()
308
+
309
+ # with gr.Blocks() as demo:
310
+ # input_text = gr.Textbox(label="Input")
311
+ # user_id = gr.Textbox(label="User ID")
312
+ # output_text = gr.Textbox(label="Output")
313
+ # status_text = gr.Markdown("Enter a User ID and submit to join the queue.")
314
+ # submit_btn = gr.Button("Submit")
315
+
316
+ # submit_btn.click(
317
+ # fn=gradio_function,
318
+ # inputs=[input_text, user_id],
319
+ # outputs=[output_text, status_text]
320
  # )
321
 
322
+ # demo.load(
323
+ # fn=get_queue_status,
324
+ # inputs=user_id,
325
+ # outputs=status_text,
 
 
 
 
326
  # )
327
 
328
+ # demo.queue(default_concurrency_limit=1, max_size=100)
329
+ # demo.launch()