Spaces:
Running
Running
MilesCranmer
commited on
Commit
•
71ed397
1
Parent(s):
e69aea3
Manually load julia
Browse files- gui/app.py +22 -7
gui/app.py
CHANGED
@@ -6,6 +6,13 @@ import numpy as np
|
|
6 |
import pandas as pd
|
7 |
import traceback as tb
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
def greet(
|
11 |
file_obj: tempfile._TemporaryFileWrapper,
|
@@ -14,13 +21,6 @@ def greet(
|
|
14 |
binary_operators: list,
|
15 |
unary_operators: list,
|
16 |
):
|
17 |
-
empty_df = pd.DataFrame(
|
18 |
-
{
|
19 |
-
"equation": [],
|
20 |
-
"loss": [],
|
21 |
-
"complexity": [],
|
22 |
-
}
|
23 |
-
)
|
24 |
if col_to_fit == "":
|
25 |
return (
|
26 |
empty_df,
|
@@ -44,6 +44,21 @@ def greet(
|
|
44 |
python -c 'import pysr; pysr.install()'
|
45 |
fi"""
|
46 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
from pysr import PySRRegressor
|
48 |
|
49 |
df = pd.read_csv(file_obj.name)
|
|
|
6 |
import pandas as pd
|
7 |
import traceback as tb
|
8 |
|
9 |
+
empty_df = pd.DataFrame(
|
10 |
+
{
|
11 |
+
"equation": [],
|
12 |
+
"loss": [],
|
13 |
+
"complexity": [],
|
14 |
+
}
|
15 |
+
)
|
16 |
|
17 |
def greet(
|
18 |
file_obj: tempfile._TemporaryFileWrapper,
|
|
|
21 |
binary_operators: list,
|
22 |
unary_operators: list,
|
23 |
):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
if col_to_fit == "":
|
25 |
return (
|
26 |
empty_df,
|
|
|
44 |
python -c 'import pysr; pysr.install()'
|
45 |
fi"""
|
46 |
)
|
47 |
+
|
48 |
+
import pysr
|
49 |
+
try:
|
50 |
+
from julia.api import JuliaInfo
|
51 |
+
info = JuliaInfo.load(julia="/usr/bin/julia")
|
52 |
+
from julia import Main as _Main
|
53 |
+
pysr.sr.Main = _Main
|
54 |
+
except Exception as e:
|
55 |
+
error_message = tb.format_exc()
|
56 |
+
return (
|
57 |
+
empty_df,
|
58 |
+
error_message,
|
59 |
+
)
|
60 |
+
|
61 |
+
|
62 |
from pysr import PySRRegressor
|
63 |
|
64 |
df = pd.read_csv(file_obj.name)
|