nowweb
Browse files- main.py +4 -1
- main_noweb.py +10 -6
main.py
CHANGED
@@ -305,7 +305,10 @@ with block:
|
|
305 |
|
306 |
|
307 |
if __name__ == "__main__":
|
308 |
-
block.queue()
|
|
|
|
|
|
|
309 |
block.launch(server_name="0.0.0.0", server_port=7860)
|
310 |
|
311 |
|
|
|
305 |
|
306 |
|
307 |
if __name__ == "__main__":
|
308 |
+
block.queue(concurrency_count=5, # When you increase the concurrency_count parameter in queue(), max_threads() in launch() is automatically increased as well.
|
309 |
+
max_size=25, # Maximum number of requests that the queue processes
|
310 |
+
api_open = False # When creating a Gradio demo, you may want to restrict all traffic to happen through the user interface as opposed to the programmatic API that is automatically created for your Gradio demo.
|
311 |
+
) # https://www.gradio.app/guides/setting-up-a-demo-for-maximum-performance
|
312 |
block.launch(server_name="0.0.0.0", server_port=7860)
|
313 |
|
314 |
|
main_noweb.py
CHANGED
@@ -139,23 +139,24 @@ def pose2d(video, kpt_threshold):
|
|
139 |
# Define new unique folder
|
140 |
add_dir = str(uuid.uuid4())
|
141 |
vis_out_dir = os.path.join("/".join(video.split("/")[:-1]), add_dir)
|
142 |
-
|
|
|
143 |
|
144 |
result_generator = human(video,
|
145 |
-
vis_out_dir =
|
146 |
return_vis=True,
|
147 |
radius = 5,
|
148 |
thickness=4,
|
149 |
rebase_keypoint_height=True,
|
150 |
kpt_thr=kpt_threshold,
|
151 |
device=device,
|
152 |
-
pred_out_dir =
|
153 |
)
|
154 |
|
155 |
result = [result for result in result_generator] #next(result_generator)
|
156 |
|
157 |
-
out_file = glob.glob(os.path.join(
|
158 |
-
kpoints = glob.glob(os.path.join(
|
159 |
|
160 |
return "".join(out_file), "".join(kpoints)
|
161 |
|
@@ -264,7 +265,10 @@ with block:
|
|
264 |
queue=False)
|
265 |
|
266 |
if __name__ == "__main__":
|
267 |
-
block.queue()
|
|
|
|
|
|
|
268 |
block.launch(server_name="0.0.0.0", server_port=7860)
|
269 |
|
270 |
|
|
|
139 |
# Define new unique folder
|
140 |
add_dir = str(uuid.uuid4())
|
141 |
vis_out_dir = os.path.join("/".join(video.split("/")[:-1]), add_dir)
|
142 |
+
|
143 |
+
os.makedirs(add_dir)
|
144 |
|
145 |
result_generator = human(video,
|
146 |
+
vis_out_dir = add_dir,
|
147 |
return_vis=True,
|
148 |
radius = 5,
|
149 |
thickness=4,
|
150 |
rebase_keypoint_height=True,
|
151 |
kpt_thr=kpt_threshold,
|
152 |
device=device,
|
153 |
+
pred_out_dir = add_dir
|
154 |
)
|
155 |
|
156 |
result = [result for result in result_generator] #next(result_generator)
|
157 |
|
158 |
+
out_file = glob.glob(os.path.join(add_dir, "*.mp4")) #+ glob.glob(os.path.join(vis_out_dir, "*.webm"))
|
159 |
+
kpoints = glob.glob(os.path.join(add_dir, "*.json"))
|
160 |
|
161 |
return "".join(out_file), "".join(kpoints)
|
162 |
|
|
|
265 |
queue=False)
|
266 |
|
267 |
if __name__ == "__main__":
|
268 |
+
block.queue(concurrency_count=10, # When you increase the concurrency_count parameter in queue(), max_threads() in launch() is automatically increased as well.
|
269 |
+
max_size=25, # Maximum number of requests that the queue processes
|
270 |
+
api_open = False # When creating a Gradio demo, you may want to restrict all traffic to happen through the user interface as opposed to the programmatic API that is automatically created for your Gradio demo.
|
271 |
+
) # https://www.gradio.app/guides/setting-up-a-demo-for-maximum-performance
|
272 |
block.launch(server_name="0.0.0.0", server_port=7860)
|
273 |
|
274 |
|