File size: 1,970 Bytes
cf004a6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
"""
This script runs the streamlit app for MHNfs

MHNfs: Few-shot method for drug discovery activity predictions
       (https://openreview.net/pdf?id=XrMWUuEevr)
"""

# --------------------------------------------------------------------------------------
# Imports
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

# --------------------------------------------------------------------------------------
# Functions
class App():
    def __init__(self):
        # Set page configration to wide
        st.set_page_config(layout="wide", page_title="MHNfs", page_icon="🔬")
        
        # Layout maker
        self.layoutMaker = LayoutMaker()
        
        # Load mhnfs model
        self.predictor = ActivityPredictor()
        
    def define_layout(self):

        # Define Sidebar width
        css = '''
        <style>
            [data-testid="stSidebar"]{
                min-width: 500px;
                max-width: 500px;
            }
        </style>
        '''
        st.markdown(css, unsafe_allow_html=True)

        # Sidebar
        self.inputs, self.buttons = self.layoutMaker.make_sidebar()
           
        # Main page
        # - header
        self.layoutMaker.make_header()
        
        # - main body
        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()


# --------------------------------------------------------------------------------------
# Run script
if __name__ == "__main__":
    run_app()