TroglodyteDerivations
commited on
Commit
•
630ae70
1
Parent(s):
187a26b
Updated optimize function reverting the constructor back into three original arguments (npart, ndim, max_iter) and updated iface = gr.Interface() by removing the additional parameters
Browse files
app.py
CHANGED
@@ -382,7 +382,7 @@ class GWO:
|
|
382 |
# Return the video path
|
383 |
return video_path
|
384 |
|
385 |
-
def optimize(npart, ndim, max_iter
|
386 |
# Initialize the GWO algorithm with the provided parameters
|
387 |
gwo = GWO(obj=obj, npart=npart, ndim=ndim, max_iter=max_iter, init=init, bounds=bounds)
|
388 |
|
@@ -403,6 +403,7 @@ def optimize(npart, ndim, max_iter, obj, goal, frames, interval):
|
|
403 |
# Return the path to the video file
|
404 |
return video_path, best_fitness_text, best_positions_text
|
405 |
|
|
|
406 |
# Define the Gradio interface
|
407 |
iface = gr.Interface(
|
408 |
fn=optimize, # Pass the optimize function object
|
@@ -410,11 +411,6 @@ iface = gr.Interface(
|
|
410 |
gr.components.Slider(10, 50, 50, step=1, label="Number of Wolves"),
|
411 |
gr.components.Slider(3, 3, 3, step=1, label="Number of Dimensions"),
|
412 |
gr.components.Slider(100, 200, 200, step=1, label="Maximum Iterations"),
|
413 |
-
gr.components.Number(-5.0,-5.0,-5.0, step=1, label="Objective Value"),
|
414 |
-
gr.components.Number(2.2,2.2,2.2, step=1, label="Goal Position X"),
|
415 |
-
gr.components.Number(4.3,4.3,4.3, step=1, label="Goal Position Y"),
|
416 |
-
gr.components.Number(100,100,100, step=1, label="Frames"),
|
417 |
-
gr.components.Number(50,50,50, step=1, label="Interval"),
|
418 |
],
|
419 |
outputs=[
|
420 |
gr.components.Video(format="mp4"),
|
@@ -422,6 +418,9 @@ iface = gr.Interface(
|
|
422 |
gr.components.Textbox(label="Best Positions"),
|
423 |
],
|
424 |
)
|
|
|
|
|
|
|
425 |
#inputs=[
|
426 |
#gr.components.Slider(10, 50, 50, step=1, label="Number of Wolves [Default = 50 Wolves]"),
|
427 |
#gr.components.Slider(3, 3, 3, step=1, label="Search Space Dimensionality [Set as 3-dimensional]"),
|
|
|
382 |
# Return the video path
|
383 |
return video_path
|
384 |
|
385 |
+
def optimize(npart, ndim, max_iter):
|
386 |
# Initialize the GWO algorithm with the provided parameters
|
387 |
gwo = GWO(obj=obj, npart=npart, ndim=ndim, max_iter=max_iter, init=init, bounds=bounds)
|
388 |
|
|
|
403 |
# Return the path to the video file
|
404 |
return video_path, best_fitness_text, best_positions_text
|
405 |
|
406 |
+
|
407 |
# Define the Gradio interface
|
408 |
iface = gr.Interface(
|
409 |
fn=optimize, # Pass the optimize function object
|
|
|
411 |
gr.components.Slider(10, 50, 50, step=1, label="Number of Wolves"),
|
412 |
gr.components.Slider(3, 3, 3, step=1, label="Number of Dimensions"),
|
413 |
gr.components.Slider(100, 200, 200, step=1, label="Maximum Iterations"),
|
|
|
|
|
|
|
|
|
|
|
414 |
],
|
415 |
outputs=[
|
416 |
gr.components.Video(format="mp4"),
|
|
|
418 |
gr.components.Textbox(label="Best Positions"),
|
419 |
],
|
420 |
)
|
421 |
+
|
422 |
+
# Launch the interface
|
423 |
+
iface.launch()
|
424 |
#inputs=[
|
425 |
#gr.components.Slider(10, 50, 50, step=1, label="Number of Wolves [Default = 50 Wolves]"),
|
426 |
#gr.components.Slider(3, 3, 3, step=1, label="Search Space Dimensionality [Set as 3-dimensional]"),
|