Spaces:
Runtime error
Runtime error
Download app.py from snaramirez872/gibberish-detection-python-app: direct link, hf CLI and curl.
- Browser
- Download file 828 Bytes
-
https://huggingface.co/spaces/snaramirez872/gibberish-detection-python-app/resolve/main/app.py
- Command line
-
hf download hf://spaces/snaramirez872/gibberish-detection-python-app/app.py
-
curl -L -o app.py https://huggingface.co/spaces/snaramirez872/gibberish-detection-python-app/resolve/main/app.py
828 Bytes
| 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) | |
| result = pipeline("sentiment-analysis", model=mod, tokenizer=TKR) | |
| st.title("Gibberish Detector") | |
| user_input = str(st.text_input("Enter some words", "pasghetti")) | |
| # result = classifier(["This is a sample text made by Sean Ramirez.", "This is another sample text."]) # leftover from initial testing | |
| if user_input: | |
| predicts = result(user_input)[0] | |
| st.markdown("## Probabilities") | |
| st.write(f"Predicted: { predicts['label'] }") | |
| st.write(f"Score: { round(predicts['score'] * 100, 1)}%") | |