File size: 3,765 Bytes
ed63f22
 
 
 
 
 
 
 
 
 
af67ec7
ed63f22
4b042fc
9b9e904
2a7c985
 
 
4b042fc
 
9b9e904
4b042fc
 
2a7c985
4b042fc
9b9e904
2a7c985
 
 
9b9e904
 
e55ebc3
2a7c985
4b042fc
2a7c985
 
 
 
 
9b9e904
e55ebc3
2a7c985
 
 
 
 
 
 
ed63f22
523e887
fc0e9f4
 
 
 
523e887
 
 
 
 
 
 
 
 
 
 
 
ed63f22
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import streamlit as st
import torch
import requests
import time
import numpy as np
import os
from toxic1 import toxicity_page
from strim_nlp import classic_ml_page
from lstm import lstm_model_page
from bert_strim import bert_model_page
import pandas as pd


# Установка цветов и стилей
st.markdown(
    """
    <style>
        /* Установка фона для всего приложения */
        body {
            background-color: #e6fff2; /* Светло-изумрудный фон */
        }

        /* Кастомные стили CSS для боковой панели */
        .sidebar .sidebar-content {
            background-color: #00ffcc; /* Изумрудный */
        }

        /* Кастомные стили для кнопок */
        .stButton>button {
            color: #303030; /* Темно-серый для чёткости текста на светлом фоне */
            background-color: #6af5c8; /* Менее ярко-зеленая кнопка */
            border-radius: 20px; /* Закругленные углы */
            border: none;
            padding: 10px 24px;
            font-size: 16px;
            font-weight: bold;
            transition: all 0.3s; /* Плавное изменение стилей */
        }
        .stButton>button:hover {
            background-color: #b3f0d4; /* Средний оттенок менее ярко-зеленой кнопки */
        }
    </style>
    """,
    unsafe_allow_html=True
)


def app_description_page():
    st.title("Welcome to My App!")
    st.markdown("<h3 style='font-size: 18px;'>This is a Streamlit application where you can explore four different models.</h3>", unsafe_allow_html=True)
    st.markdown("<h3 style='font-size: 18px;'>About the project:</h3>", unsafe_allow_html=True)
    st.markdown("<h3 style='font-size: 18px;'>The task is to train 3 different models on a dataset that contains reviews about the clinic.</h3>", unsafe_allow_html=True)
    st.markdown("<h3 style='font-size: 18px;'>You can write text and the model will classify it as “Negative” or “Positive”</h3>", 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("<h3 style='font-size: 18px;'>Models:</h3>", unsafe_allow_html=True)
    st.markdown("<h3 style='font-size: 18px;'>1. CatBoostClassifier trained on TF-IDF </h3>", unsafe_allow_html=True)
    st.markdown("<h3 style='font-size: 18px;'>2. LSTM with BahdanauAttention </h3>", unsafe_allow_html=True)
    st.markdown("<h3 style='font-size: 18px;'>3. Rubert-tiny2 </h3>", unsafe_allow_html=True)
    st.markdown("<h3 style='font-size: 18px;'>4. Rubert-tiny-toxicity </h3>", unsafe_allow_html=True)
    st.dataframe(df)
    st.image('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()