Update app.py
Browse files
app.py
CHANGED
@@ -2,12 +2,14 @@ import gradio
|
|
2 |
import kaboom
|
3 |
from kaboom.carMakers import runCarDesignProblem
|
4 |
|
5 |
-
def run_kaboom(reps):
|
6 |
|
7 |
#create a parameters object
|
8 |
#parameters (p.nAgents = 33, p.nTeams = 11, p.nDims = 56) are automatically set for this problem.
|
9 |
parameters = kaboom.params.Params()
|
10 |
parameters.reps = reps
|
|
|
|
|
11 |
|
12 |
#run the simulation with the car designer objective
|
13 |
team = runCarDesignProblem(parameters)
|
@@ -17,5 +19,10 @@ def run_kaboom(reps):
|
|
17 |
return team.getBestScore()*-1
|
18 |
|
19 |
gradio.Interface(
|
20 |
-
fn = run_kaboom,
|
|
|
|
|
|
|
|
|
|
|
21 |
).launch(debug=True)
|
|
|
2 |
import kaboom
|
3 |
from kaboom.carMakers import runCarDesignProblem
|
4 |
|
5 |
+
def run_kaboom(reps, steps, comms):
|
6 |
|
7 |
#create a parameters object
|
8 |
#parameters (p.nAgents = 33, p.nTeams = 11, p.nDims = 56) are automatically set for this problem.
|
9 |
parameters = kaboom.params.Params()
|
10 |
parameters.reps = reps
|
11 |
+
parameters.pComm = comms
|
12 |
+
parameters.steps = steps
|
13 |
|
14 |
#run the simulation with the car designer objective
|
15 |
team = runCarDesignProblem(parameters)
|
|
|
19 |
return team.getBestScore()*-1
|
20 |
|
21 |
gradio.Interface(
|
22 |
+
fn = run_kaboom,
|
23 |
+
inputs = [
|
24 |
+
gradio.Number(label="Number of teams", value=2),
|
25 |
+
gradio.Number(label="Steps", value=300),
|
26 |
+
gradio.Number(label="Probability of Communication", value=0.2),
|
27 |
+
], outputs = [gradio.Number(label="Performance")]
|
28 |
).launch(debug=True)
|