Skip to content

Commit 985f8fa

Browse files
committed
Revert "Integrate gui in main codebase"
This reverts commit 86e9755.
1 parent 86e9755 commit 985f8fa

File tree

6 files changed

+16
-39
lines changed

6 files changed

+16
-39
lines changed

pysr/gui/app.py renamed to gui/app.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
1+
import gradio as gr
2+
13
from .data import test_equations
24
from .plots import replot, replot_pareto
35
from .processing import processing
46

57

6-
def get_gr():
7-
import gradio as gr
8-
9-
return gr
10-
11-
128
def _data_layout():
13-
gr = get_gr()
14-
159
with gr.Tab("Example Data"):
1610
# Plot of the example data:
1711
with gr.Row():
@@ -49,8 +43,6 @@ def _data_layout():
4943

5044

5145
def _settings_layout():
52-
gr = get_gr()
53-
5446
with gr.Tab("Basic Settings"):
5547
binary_operators = gr.CheckboxGroup(
5648
choices=["+", "-", "*", "/", "^", "max", "min", "mod", "cond"],
@@ -179,8 +171,6 @@ def _settings_layout():
179171

180172

181173
def main():
182-
gr = get_gr()
183-
184174
blocks = {}
185175
with gr.Blocks() as demo:
186176
with gr.Row():
@@ -255,3 +245,7 @@ def main():
255245
demo.load(replot, eqn_components, blocks["example_plot"])
256246

257247
demo.launch(debug=True)
248+
249+
250+
if __name__ == "__main__":
251+
main()
File renamed without changes.

pysr/gui/plots.py renamed to gui/plots.py

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,20 @@
11
import numpy as np
22
import pandas as pd
3+
from matplotlib import pyplot as plt
34

4-
from .data import generate_data
5-
6-
FIRST_LOAD = True
7-
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+
]
813

9-
def get_plt():
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
14+
from .data import generate_data
2415

2516

2617
def replot_pareto(df: pd.DataFrame, maxsize: int):
27-
plt = get_plt()
2818
fig, ax = plt.subplots(figsize=(6, 6), dpi=100)
2919

3020
if len(df) == 0 or "Equation" not in df.columns:
@@ -70,7 +60,6 @@ def replot(test_equation, num_points, noise_level, data_seed):
7060
X, y = generate_data(test_equation, num_points, noise_level, data_seed)
7161
x = X["x"]
7262

73-
plt = get_plt()
7463
plt.rcParams["font.family"] = "IBM Plex Mono"
7564
fig, ax = plt.subplots(figsize=(6, 6), dpi=100)
7665

File renamed without changes.
File renamed without changes.

pysr/_cli/main.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
import click
77

8-
from ..gui import main as gui_main
98
from ..test import (
109
get_runtests_cli,
1110
runtests,
@@ -49,11 +48,6 @@ def _install(julia_project, quiet, precompile):
4948
)
5049

5150

52-
@pysr.command("gui", help="Start a Gradio-based GUI.")
53-
def _gui():
54-
gui_main()
55-
56-
5751
TEST_OPTIONS = {"main", "jax", "torch", "cli", "dev", "startup"}
5852

5953

0 commit comments

Comments
 (0)