Spaces:
Runtime error
Runtime error
Increment model version
Browse files
app.py
CHANGED
|
@@ -6,8 +6,12 @@ import seaborn as sns
|
|
| 6 |
import matplotlib.pyplot as plt
|
| 7 |
from warnings import warn
|
| 8 |
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
@st.experimental_memo
|
| 13 |
def load_data():
|
|
@@ -23,13 +27,13 @@ def load_data():
|
|
| 23 |
subreddits_fg.select(features=["subreddit_id", "snapshot_time"]), on=["subreddit_id", "snapshot_time"])
|
| 24 |
df = full_join.read()
|
| 25 |
except Exception as e:
|
| 26 |
-
warn("Could not load data from feature store (most likely due to Port issues with Hopsworks). Trying to load
|
| 27 |
warn(str(e))
|
| 28 |
df = None
|
| 29 |
|
| 30 |
# Load model including the generated images and evaluation scores
|
| 31 |
mr = project.get_model_registry()
|
| 32 |
-
model_hsfs = mr.get_model("reddit_predict", version=
|
| 33 |
model_dir = model_hsfs.download()
|
| 34 |
print("Model directory: {}".format(model_dir))
|
| 35 |
|
|
@@ -62,7 +66,7 @@ def load_data():
|
|
| 62 |
df, plots, df_metrics = load_data()
|
| 63 |
|
| 64 |
if df is None:
|
| 65 |
-
st.error("Could not load data from feature store or model directory
|
| 66 |
st.stop()
|
| 67 |
|
| 68 |
# create a distribution plot of the number of likes using seaborn
|
|
|
|
| 6 |
import matplotlib.pyplot as plt
|
| 7 |
from warnings import warn
|
| 8 |
|
| 9 |
+
is_local=False
|
| 10 |
+
if is_local:
|
| 11 |
+
from dotenv import load_dotenv
|
| 12 |
+
load_dotenv()
|
| 13 |
+
|
| 14 |
+
MODEL_VERSION=22
|
| 15 |
|
| 16 |
@st.experimental_memo
|
| 17 |
def load_data():
|
|
|
|
| 27 |
subreddits_fg.select(features=["subreddit_id", "snapshot_time"]), on=["subreddit_id", "snapshot_time"])
|
| 28 |
df = full_join.read()
|
| 29 |
except Exception as e:
|
| 30 |
+
warn("Could not load data from feature store (most likely due to Port issues with Hopsworks). Trying to load the data from the model registry instead. Full exception:")
|
| 31 |
warn(str(e))
|
| 32 |
df = None
|
| 33 |
|
| 34 |
# Load model including the generated images and evaluation scores
|
| 35 |
mr = project.get_model_registry()
|
| 36 |
+
model_hsfs = mr.get_model("reddit_predict", version=MODEL_VERSION)
|
| 37 |
model_dir = model_hsfs.download()
|
| 38 |
print("Model directory: {}".format(model_dir))
|
| 39 |
|
|
|
|
| 66 |
df, plots, df_metrics = load_data()
|
| 67 |
|
| 68 |
if df is None:
|
| 69 |
+
st.error("Could not load data from feature store or model directory as Huggingface has compatibility issues with parts of the data read API from Hopsworks.")
|
| 70 |
st.stop()
|
| 71 |
|
| 72 |
# create a distribution plot of the number of likes using seaborn
|