Add some settings for user concurrency limits
Browse files
app.py
CHANGED
@@ -40,7 +40,7 @@ To follow the progress of KAN in RL you can check the repo [kanrl](https://githu
|
|
40 |
*Please be patient, as the process may take a few minutes to run, especially in environments with large state/action spaces or with a complex KAN architecture. Some Mujoco environments are available if you run this app locally. For optimal performance, default parameters may not suffice. Feel free to experiment with different settings to achieve desired results.*
|
41 |
"""
|
42 |
|
43 |
-
envs = ["CartPole-v1", "MountainCar-v0", "Acrobot-v1", "Pendulum-v1", "MountainCarContinuous-v0", "LunarLander-v2", "BipedalWalker-v3"]#"Swimmer-v3", "Hopper-v3", "HalfCheetah-v3", "Walker2d-v3"]
|
44 |
|
45 |
|
46 |
if __name__ == "__main__":
|
@@ -140,9 +140,9 @@ if __name__ == "__main__":
|
|
140 |
kan_architecture = gr.Image(interactive=False, label="KAN architecture")
|
141 |
sym_video = gr.Video(label="Symbolic policy video", interactive=False, autoplay=True)
|
142 |
sym_formula = gr.Markdown(elem_id="formula")
|
143 |
-
choice.input(load_video_and_dataset, inputs=[choice], outputs=[expert_video, button, state])
|
144 |
button.click(extract_interpretable_policy, inputs=[kan_widths, epochs, state], outputs=[kan_architecture, state]).then(
|
145 |
symbolic_policy, inputs=[state], outputs=[sym_video, sym_formula]
|
146 |
)
|
147 |
-
|
148 |
app.launch()
|
|
|
40 |
*Please be patient, as the process may take a few minutes to run, especially in environments with large state/action spaces or with a complex KAN architecture. Some Mujoco environments are available if you run this app locally. For optimal performance, default parameters may not suffice. Feel free to experiment with different settings to achieve desired results.*
|
41 |
"""
|
42 |
|
43 |
+
envs = ["CartPole-v1", "MountainCar-v0", "Acrobot-v1", "Pendulum-v1", "MountainCarContinuous-v0", "LunarLander-v2", "BipedalWalker-v3"] #"Swimmer-v3", "Hopper-v3", "HalfCheetah-v3", "Walker2d-v3"]
|
44 |
|
45 |
|
46 |
if __name__ == "__main__":
|
|
|
140 |
kan_architecture = gr.Image(interactive=False, label="KAN architecture")
|
141 |
sym_video = gr.Video(label="Symbolic policy video", interactive=False, autoplay=True)
|
142 |
sym_formula = gr.Markdown(elem_id="formula")
|
143 |
+
choice.input(load_video_and_dataset, inputs=[choice], outputs=[expert_video, button, state], concurrency_limit=8)
|
144 |
button.click(extract_interpretable_policy, inputs=[kan_widths, epochs, state], outputs=[kan_architecture, state]).then(
|
145 |
symbolic_policy, inputs=[state], outputs=[sym_video, sym_formula]
|
146 |
)
|
147 |
+
app.queue(default_concurrency_limit=3, max_size=10)
|
148 |
app.launch()
|