NLP_project / app.py
osheina's picture
app.py
ad4dbc3 verified
raw
history blame contribute delete
No virus
2.31 kB
import streamlit as st
import torch
import requests
from PIL import Image
from io import BytesIO
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
# Определение первой страницы с общим описанием приложения
def app_description_page():
st.title("Welcome to My App!")
st.write("This is a Streamlit application where you can explore two different models.")
# Определение второй страницы с обеими моделями и выбором между ними
def model_selection_page():
st.sidebar.title("Model Selection")
selected_model = st.sidebar.radio("Select a model", ("Classic ML", "LSTM", "BERT"))
# Depending on the model selected, display different information or use different models
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.")
# Add other components for review prediction here if needed
# Определение главной функции
def main():
# st.sidebar.title("Navigation") # You can remove or comment out this line since the sidebar title is set in model_selection_page now
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() # Call the function from toxic.py
# Запуск главной функции
if __name__ == "__main__":
main()