Spaces:
Runtime error
Runtime error
File size: 935 Bytes
af36e0b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import streamlit as st
from transformers import pipeline
from transformers import AutoTokenizer as AT, AutoModelForSequenceClassification as AFSC
modName = "madhurjindal/autonlp-Gibberish-Detector-492513457" # Gibberish Detection Model from HuggingFace
mod = AFSC.from_pretrained(modName)
TKR = AT.from_pretrained(modName)
st.title("Gibberish Detector")
user_input = st.text_input("Enter some words", "[Pre-populted Text]: pasghetti")
st.markdown("Input was: ", user_input)
classifier = pipeline("sentiment-analysis", model=mod, tokenizer=TKR)
# result = classifier(["This is a sample text made by Sean Ramirez.", "This is another sample text."]) # leftover from initial testing
if user_input is not None:
col = st.columns(1)
predicts = pipeline("sentiment-analysis", model=mod, tokenizer=TKR)
col.header("Probabilities")
for p in predicts:
col.subheader(f"{ p['label']}: { round(p['score'] * 100, 1)}%") |