-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #82 from VIDA-NYU/streamlit
Add streamlit app
- Loading branch information
Showing
9 changed files
with
414 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,3 +59,4 @@ lightning_logs | |
**/lightning_logs | ||
.cache | ||
**/smac3_output | ||
/venv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from sklearn.pipeline import Pipeline as Pipeline | ||
|
||
|
||
class PipelineSerializer(Pipeline): | ||
|
||
def __init__(self, pipeline_sk, label_encoder=None): | ||
self.label_encoder = label_encoder | ||
super().__init__(pipeline_sk.steps) | ||
|
||
def fit(self, X, y): | ||
if self.label_encoder is not None: | ||
y = self.label_encoder.fit_transform(y) | ||
super().fit(X, y) | ||
|
||
def predict(self, X): | ||
predictions = super().predict(X) | ||
|
||
if self.label_encoder is not None: | ||
return self.label_encoder.inverse_transform(predictions) | ||
else: | ||
return predictions | ||
|
||
def predict_proba(self, X): | ||
return super().predict_proba(X) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[server] | ||
maxUploadSize = 2000 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import streamlit as st | ||
from sklearn import set_config | ||
|
||
|
||
set_config(display="html") | ||
|
||
st.set_page_config( | ||
page_title="Alpha-AutoML App", | ||
) | ||
|
||
|
||
with st.columns(3)[1]: | ||
st.image("https://github.com/VIDA-NYU/alpha-automl/raw/devel/Alpha-AutoML_logo.png") | ||
|
||
st.markdown( | ||
"<p style='text-align: center;'>An extensible open-source AutoML system that supports multiple ML tasks </p>", | ||
unsafe_allow_html=True, | ||
) | ||
|
||
st.divider() | ||
|
||
st.markdown( | ||
"<p style='text-align: justify;'>Alpha-AutoML leverages in reinforcement learning and neural network components " | ||
"and it relies on standard, open-source infrastructure to specify and run pipelines. It is compatible with " | ||
"state-of-the-art ML techniques: by using the Sklearn pipeline infrastructure, Alpha-AutoML is fully compatible " | ||
"with other standard libraries like XGBoost, Hugging Face, Keras, PyTorch. In addition, primitives can be added on " | ||
"the fly through the standard Sklearn’s fit/predict API, making it possible for Alpha-AutoML to leverage new " | ||
"developments in ML and keep up with the fast pace in the area. </p>", | ||
unsafe_allow_html=True, | ||
) | ||
|
||
st.divider() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Alpha-AutoML Streamlit App | ||
|
||
This directory contains a Streamlit app that implements model training and prediction using the `alpha-automl` system. | ||
|
||
## Required dependencies | ||
|
||
Make sure to install the following dependencies: | ||
- alpha-automl[image] | ||
- streamlit | ||
|
||
We recommend creating a virtual environment to avoid dependency conflicts: | ||
``` | ||
python -m venv venv | ||
source venv/bin/activate | ||
pip install alpha-automl[image]@"git+https://github.com/VIDA-NYU/alpha-automl@devel" | ||
pip install streamlit | ||
``` | ||
|
||
In the commands above, we are installing a specific version of alpha-automl, including the optional `image` dependencies that are required to support building models for image classification. | ||
|
||
## Running the app | ||
|
||
To run the app execute the following command: | ||
|
||
``` | ||
streamlit run Home.py | ||
``` | ||
|
||
The command will print a message like this: | ||
``` | ||
You can now view your Streamlit app in your browser. | ||
Local URL: http://localhost:8501 | ||
Network URL: http://192.168.1.150:8501 | ||
``` | ||
Now you can open the app using your browser using one of the addresses specified above, e.g., http://localhost:8501. |
Oops, something went wrong.