Spaces:
Sleeping
Sleeping
Revert "Integrate gui in main codebase"
Browse filesThis reverts commit 86e9755485e0af7911a90f6bc3b2f07dc061f6ed.
- {pysr/gui β gui}/app.py +6 -12
- {pysr/gui β gui}/data.py +0 -0
- {pysr/gui β gui}/plots.py +10 -21
- {pysr/gui β gui}/processing.py +0 -0
- requirements-gui.txt β gui/requirements.txt +0 -0
- pysr/_cli/main.py +0 -6
{pysr/gui β gui}/app.py
RENAMED
|
@@ -1,17 +1,11 @@
|
|
|
|
|
|
|
|
| 1 |
from .data import test_equations
|
| 2 |
from .plots import replot, replot_pareto
|
| 3 |
from .processing import processing
|
| 4 |
|
| 5 |
|
| 6 |
-
def get_gr():
|
| 7 |
-
import gradio as gr
|
| 8 |
-
|
| 9 |
-
return gr
|
| 10 |
-
|
| 11 |
-
|
| 12 |
def _data_layout():
|
| 13 |
-
gr = get_gr()
|
| 14 |
-
|
| 15 |
with gr.Tab("Example Data"):
|
| 16 |
# Plot of the example data:
|
| 17 |
with gr.Row():
|
|
@@ -49,8 +43,6 @@ def _data_layout():
|
|
| 49 |
|
| 50 |
|
| 51 |
def _settings_layout():
|
| 52 |
-
gr = get_gr()
|
| 53 |
-
|
| 54 |
with gr.Tab("Basic Settings"):
|
| 55 |
binary_operators = gr.CheckboxGroup(
|
| 56 |
choices=["+", "-", "*", "/", "^", "max", "min", "mod", "cond"],
|
|
@@ -179,8 +171,6 @@ def _settings_layout():
|
|
| 179 |
|
| 180 |
|
| 181 |
def main():
|
| 182 |
-
gr = get_gr()
|
| 183 |
-
|
| 184 |
blocks = {}
|
| 185 |
with gr.Blocks() as demo:
|
| 186 |
with gr.Row():
|
|
@@ -255,3 +245,7 @@ def main():
|
|
| 255 |
demo.load(replot, eqn_components, blocks["example_plot"])
|
| 256 |
|
| 257 |
demo.launch(debug=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
from .data import test_equations
|
| 4 |
from .plots import replot, replot_pareto
|
| 5 |
from .processing import processing
|
| 6 |
|
| 7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
def _data_layout():
|
|
|
|
|
|
|
| 9 |
with gr.Tab("Example Data"):
|
| 10 |
# Plot of the example data:
|
| 11 |
with gr.Row():
|
|
|
|
| 43 |
|
| 44 |
|
| 45 |
def _settings_layout():
|
|
|
|
|
|
|
| 46 |
with gr.Tab("Basic Settings"):
|
| 47 |
binary_operators = gr.CheckboxGroup(
|
| 48 |
choices=["+", "-", "*", "/", "^", "max", "min", "mod", "cond"],
|
|
|
|
| 171 |
|
| 172 |
|
| 173 |
def main():
|
|
|
|
|
|
|
| 174 |
blocks = {}
|
| 175 |
with gr.Blocks() as demo:
|
| 176 |
with gr.Row():
|
|
|
|
| 245 |
demo.load(replot, eqn_components, blocks["example_plot"])
|
| 246 |
|
| 247 |
demo.launch(debug=True)
|
| 248 |
+
|
| 249 |
+
|
| 250 |
+
if __name__ == "__main__":
|
| 251 |
+
main()
|
{pysr/gui β gui}/data.py
RENAMED
|
File without changes
|
{pysr/gui β gui}/plots.py
RENAMED
|
@@ -1,30 +1,20 @@
|
|
| 1 |
import numpy as np
|
| 2 |
import pandas as pd
|
|
|
|
| 3 |
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
-
|
| 10 |
-
from matplotlib import pyplot as plt
|
| 11 |
-
|
| 12 |
-
if FIRST_LOAD:
|
| 13 |
-
plt.ioff()
|
| 14 |
-
plt.rcParams["font.family"] = [
|
| 15 |
-
"IBM Plex Mono",
|
| 16 |
-
# Fallback fonts:
|
| 17 |
-
"DejaVu Sans Mono",
|
| 18 |
-
"Courier New",
|
| 19 |
-
"monospace",
|
| 20 |
-
]
|
| 21 |
-
|
| 22 |
-
FIRST_LOAD = False
|
| 23 |
-
return plt
|
| 24 |
|
| 25 |
|
| 26 |
def replot_pareto(df: pd.DataFrame, maxsize: int):
|
| 27 |
-
plt = get_plt()
|
| 28 |
fig, ax = plt.subplots(figsize=(6, 6), dpi=100)
|
| 29 |
|
| 30 |
if len(df) == 0 or "Equation" not in df.columns:
|
|
@@ -70,7 +60,6 @@ def replot(test_equation, num_points, noise_level, data_seed):
|
|
| 70 |
X, y = generate_data(test_equation, num_points, noise_level, data_seed)
|
| 71 |
x = X["x"]
|
| 72 |
|
| 73 |
-
plt = get_plt()
|
| 74 |
plt.rcParams["font.family"] = "IBM Plex Mono"
|
| 75 |
fig, ax = plt.subplots(figsize=(6, 6), dpi=100)
|
| 76 |
|
|
|
|
| 1 |
import numpy as np
|
| 2 |
import pandas as pd
|
| 3 |
+
from matplotlib import pyplot as plt
|
| 4 |
|
| 5 |
+
plt.ioff()
|
| 6 |
+
plt.rcParams["font.family"] = [
|
| 7 |
+
"IBM Plex Mono",
|
| 8 |
+
# Fallback fonts:
|
| 9 |
+
"DejaVu Sans Mono",
|
| 10 |
+
"Courier New",
|
| 11 |
+
"monospace",
|
| 12 |
+
]
|
| 13 |
|
| 14 |
+
from .data import generate_data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
|
| 17 |
def replot_pareto(df: pd.DataFrame, maxsize: int):
|
|
|
|
| 18 |
fig, ax = plt.subplots(figsize=(6, 6), dpi=100)
|
| 19 |
|
| 20 |
if len(df) == 0 or "Equation" not in df.columns:
|
|
|
|
| 60 |
X, y = generate_data(test_equation, num_points, noise_level, data_seed)
|
| 61 |
x = X["x"]
|
| 62 |
|
|
|
|
| 63 |
plt.rcParams["font.family"] = "IBM Plex Mono"
|
| 64 |
fig, ax = plt.subplots(figsize=(6, 6), dpi=100)
|
| 65 |
|
{pysr/gui β gui}/processing.py
RENAMED
|
File without changes
|
requirements-gui.txt β gui/requirements.txt
RENAMED
|
File without changes
|
pysr/_cli/main.py
CHANGED
|
@@ -5,7 +5,6 @@ import warnings
|
|
| 5 |
|
| 6 |
import click
|
| 7 |
|
| 8 |
-
from ..gui import main as gui_main
|
| 9 |
from ..test import (
|
| 10 |
get_runtests_cli,
|
| 11 |
runtests,
|
|
@@ -49,11 +48,6 @@ def _install(julia_project, quiet, precompile):
|
|
| 49 |
)
|
| 50 |
|
| 51 |
|
| 52 |
-
@pysr.command("gui", help="Start a Gradio-based GUI.")
|
| 53 |
-
def _gui():
|
| 54 |
-
gui_main()
|
| 55 |
-
|
| 56 |
-
|
| 57 |
TEST_OPTIONS = {"main", "jax", "torch", "cli", "dev", "startup"}
|
| 58 |
|
| 59 |
|
|
|
|
| 5 |
|
| 6 |
import click
|
| 7 |
|
|
|
|
| 8 |
from ..test import (
|
| 9 |
get_runtests_cli,
|
| 10 |
runtests,
|
|
|
|
| 48 |
)
|
| 49 |
|
| 50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
TEST_OPTIONS = {"main", "jax", "torch", "cli", "dev", "startup"}
|
| 52 |
|
| 53 |
|