mayalenE commited on
Commit
97a2410
·
1 Parent(s): 802c2f0

refactored the interface

Browse files
Files changed (2) hide show
  1. README.md +1 -1
  2. app.py +26 -10
README.md CHANGED
@@ -1,5 +1,5 @@
1
  ---
2
- title: Goal Babbling - Robotic Arm
3
  emoji: 🤖
4
  colorFrom: purple
5
  colorTo: yellow
 
1
  ---
2
+ title: Goal-based Exploration of Robotic Arm
3
  emoji: 🤖
4
  colorFrom: purple
5
  colorTo: yellow
app.py CHANGED
@@ -117,15 +117,31 @@ def explore(seed, N, dim, limit):
117
 
118
 
119
 
120
- demo = gr.Interface(
121
- fn=explore,
122
- inputs=[gr.Number(value=0, minimum=0, maximum=1000, precision=0, label="Random seed"),
123
- gr.Number(value=3000, minimum=100, maximum=5000, precision=0, label="Number of exploration steps"),
124
- gr.Number(value=7, minimum=2, maximum=100, precision=0, label="Number of joints"),
125
- gr.Slider(value=150, minimum=20, maximum=180,step=10, label="Joint Angle Limit")
126
- ],
127
- outputs=[gr.ScatterPlot(x="x", y="y", label="Motor Babbling"),
128
- gr.ScatterPlot(x="x", y="y", label="Goal Babbling",)],
129
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
 
131
  demo.launch()
 
117
 
118
 
119
 
120
+ with gr.Blocks() as demo:
121
+ with gr.Row():
122
+ gr.Markdown("# Goal-based Exploration of a Robotic Arm")
123
+ gr.Markdown(
124
+ """This space is based on Fabien Benureau goal babbling tutorial, which can also be run in [this notebook](https://fabien.benureau.com/recode/benureau2015_gb/benureau2015_gb.html)
125
+ """
126
+ )
127
+ with gr.Row():
128
+ seed = gr.Number(value=0, minimum=0, maximum=1000, precision=0, label="Random seed")
129
+ N = gr.Number(value=3000, minimum=100, maximum=5000, precision=0, label="Number of exploration steps")
130
+ dim = gr.Number(value=7, minimum=2, maximum=100, precision=0, label="Number of joints")
131
+ limit = gr.Slider(value=150, minimum=20, maximum=180,step=10, label="Joint Angle Limit")
132
+
133
+ with gr.Row():
134
+ explo_btn = gr.Button("Launch Exploration! ")
135
+
136
+ with gr.Row():
137
+ rmb_plot = gr.ScatterPlot(pd.DataFrame({"x": [], "y": []}), x="x", y="y", title="Reached Positions with Random Motor Babbling",
138
+ x_lim=[-1.1, 1.1], y_lim=[-1.1, 1.1],
139
+ width=400, height=400, label="Motor Babbling")
140
+ rgb_plot = gr.ScatterPlot(pd.DataFrame({"x": [], "y": []}), x="x", y="y", title="Reached Positions with Random Motor Babbling",
141
+ x_lim=[-1.1, 1.1], y_lim=[-1.1, 1.1],
142
+ width=400, height=400, label="Goal Babbling")
143
+
144
+
145
+ explo_btn.click(explore, inputs=[seed, N, dim, limit], outputs=[rmb_plot, rgb_plot])
146
 
147
  demo.launch()