Spaces:
Runtime error
Runtime error
import asyncio | |
import gc | |
import logging | |
import os | |
import pandas as pd | |
import psutil | |
import streamlit as st | |
from PIL import Image | |
from streamlit import components | |
#from streamlit.caching import clear_cache | |
from transformers import AutoModelForSequenceClassification, AutoTokenizer | |
from transformers_interpret import SequenceClassificationExplainer | |
#os.environ["TOKENIZERS_PARALLELISM"] = "false" | |
#logging.basicConfig( | |
# format="%(asctime)s : %(levelname)s : %(message)s", level=logging.INFO | |
#) | |
#def print_memory_usage(): | |
# logging.info(f"RAM memory % used: {psutil.virtual_memory()[2]}") | |
def load_model(model_name): | |
return ( | |
AutoModelForSequenceClassification.from_pretrained(model_name), | |
AutoTokenizer.from_pretrained(model_name), | |
) | |
print ("before main") | |
st.title("Transformers Interpet Demo App") | |
print ("before main") | |
#image = Image.open("./images/tight@1920x_transparent.png") | |
#st.sidebar.image(image, use_column_width=True) | |
st.sidebar.markdown( | |
"Check out the package on [Github](https://github.com/cdpierse/transformers-interpret)" | |
) | |
st.info( | |
"Due to limited resources only low memory models are available. Run this [app locally](https://github.com/cdpierse/transformers-interpret-streamlit) to run the full selection of available models. " | |
) | |
print ("end of total file") |