import streamlit as st import os import pkg_resources # # Using this wacky hack to get around the massively ridicolous managed env loading order def is_installed(package_name, version): try: pkg = pkg_resources.get_distribution(package_name) return pkg.version == version except pkg_resources.DistributionNotFound: return False # shifted from below - this must be the first streamlit call; otherwise: problems st.set_page_config(page_title = 'Vulnerability Analysis', initial_sidebar_state='expanded', layout="wide") @st.cache_resource # cache the function so it's not called every time app.py is triggered def install_packages(): install_commands = [] if not is_installed("spaces", "0.12.0"): install_commands.append("pip install spaces==0.17.0") if not is_installed("pydantic", "1.8.2"): install_commands.append("pip install pydantic==1.8.2") if not is_installed("typer", "0.4.0"): install_commands.append("pip install typer==0.4.0") if install_commands: os.system(" && ".join(install_commands)) # install packages if necessary install_packages() import appStore.vulnerability_analysis as vulnerability_analysis import appStore.target as target_analysis import appStore.doc_processing as processing from utils.uploadAndExample import add_upload from utils.vulnerability_classifier import label_dict from utils.config import model_dict import pandas as pd import plotly.express as px # st.set_page_config(page_title = 'Vulnerability Analysis', # initial_sidebar_state='expanded', layout="wide") with st.sidebar: # upload and example doc choice = st.sidebar.radio(label = 'Select the Document', help = 'You can upload the document \ or else you can try a example document', options = ('Upload Document', 'Try Example'), horizontal = True) add_upload(choice) # Create a list of options for the dropdown model_options = ['Llama3.1-8B','Llama3.1-70B','Llama3.1-405B','Zephyr 7B β','Mistral-7B','Mixtral-8x7B'] # Dropdown selectbox: model model_sel = st.selectbox('Select a model:', model_options) model_sel_name = model_dict[model_sel] st.session_state['model_sel_name'] = model_sel_name with st.container(): st.markdown("