|
""" |
|
This script runs the streamlit app for MHNfs. |
|
|
|
MHNfs: Few-shot method for drug discovery activity predictions |
|
(https://openreview.net/pdf?id=XrMWUuEevr) |
|
""" |
|
|
|
|
|
|
|
import streamlit as st |
|
|
|
from src.app.layout import LayoutMaker |
|
from src.app.prediction_utils import (create_prediction_df, |
|
create_molecule_grid_plot) |
|
from src.prediction_pipeline import ActivityPredictor |
|
|
|
|
|
|
|
class App(): |
|
def __init__(self): |
|
|
|
st.set_page_config(layout="wide", page_title="MHNfs", page_icon="🔬") |
|
|
|
|
|
self.layoutMaker = LayoutMaker() |
|
|
|
|
|
self.predictor = ActivityPredictor() |
|
|
|
def define_layout(self): |
|
|
|
|
|
css = ''' |
|
<style> |
|
[data-testid="stSidebar"]{ |
|
min-width: 500px; |
|
max-width: 500px; |
|
} |
|
</style> |
|
''' |
|
st.markdown(css, unsafe_allow_html=True) |
|
|
|
|
|
self.inputs, self.buttons = self.layoutMaker.make_sidebar() |
|
|
|
|
|
|
|
self.layoutMaker.make_header() |
|
|
|
|
|
self.layoutMaker.make_main_content_area(self.predictor, |
|
self.inputs, |
|
self.buttons, |
|
create_prediction_df, |
|
create_molecule_grid_plot) |
|
|
|
def run_app(): |
|
app = App() |
|
app.define_layout() |
|
|
|
|
|
|
|
|
|
if __name__ == "__main__": |
|
run_app() |
|
|