import streamlit as st import torch import requests import time import numpy as np import os from Models.toxic1 import toxicity_page from Models.strim_nlp import classic_ml_page from Models.lstm import lstm_model_page from Models.bert_strim import bert_model_page import base64 import pandas as pd background_image = 'Data/chad_806facbe78804299a9eeeab5fb0a387b_3.png' st.markdown( f""" """, unsafe_allow_html=True ) def app_description_page(): st.title("Welcome to My App!") st.markdown("

This is a Streamlit application where you can explore four different models.

", unsafe_allow_html=True) st.markdown("

About the project:

", unsafe_allow_html=True) st.markdown("

The task is to train 3 different models on a dataset that contains reviews about the clinic.

", unsafe_allow_html=True) st.markdown("

You can write text and the model will classify it as “Negative” or “Positive”

", unsafe_allow_html=True) data = { "Model": ["CatBoostClassifier", "LSTM", "Rubert-tiny2", "Rubert-tiny-toxicity"], "F1 metric": [0.87, 0.94, 0.90, 0.84] } df = pd.DataFrame(data) st.markdown("

Models:

", unsafe_allow_html=True) st.markdown("

1. CatBoostClassifier trained on TF-IDF

", unsafe_allow_html=True) st.markdown("

2. LSTM with BahdanauAttention

", unsafe_allow_html=True) st.markdown("

3. Rubert-tiny2

", unsafe_allow_html=True) st.markdown("

4. Rubert-tiny-toxicity

", unsafe_allow_html=True) st.dataframe(df) st.image('Data/20182704132259.jpg', use_column_width=True) def model_selection_page(): st.sidebar.title("Model Selection") selected_model = st.sidebar.radio("Select a model", ("Classic ML", "LSTM", "BERT")) if selected_model == "Classic ML": classic_ml_page() st.write("You selected Classic ML.") elif selected_model == "LSTM": lstm_model_page() st.write("You selected LSTM.") elif selected_model == "BERT": bert_model_page() st.write("You selected BERT.") def main(): page = st.sidebar.radio("Go to", ("App Description", "Model Selection", "Toxicity Model")) if page == "App Description": app_description_page() elif page == "Model Selection": model_selection_page() elif page == "Toxicity Model": toxicity_page() if __name__ == "__main__": main()