Spaces:
Runtime error
Runtime error
snaramirez872
commited on
Commit
·
1e156f0
1
Parent(s):
9de8073
Upload app.py
Browse files
app.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from transformers import pipeline
|
3 |
+
from transformers import AutoTokenizer as AT, AutoModelForSequenceClassification as AFSC
|
4 |
+
|
5 |
+
modName = "madhurjindal/autonlp-Gibberish-Detector-492513457" # Gibberish Detection Model from HuggingFace
|
6 |
+
|
7 |
+
mod = AFSC.from_pretrained(modName)
|
8 |
+
TKR = AT.from_pretrained(modName)
|
9 |
+
|
10 |
+
result = pipeline("sentiment-analysis", model=mod, tokenizer=TKR)
|
11 |
+
|
12 |
+
st.title("Gibberish Detector")
|
13 |
+
|
14 |
+
user_input = str(st.text_input("Enter some words", "pasghetti"))
|
15 |
+
|
16 |
+
|
17 |
+
# result = classifier(["This is a sample text made by Sean Ramirez.", "This is another sample text."]) # leftover from initial testing
|
18 |
+
|
19 |
+
if user_input:
|
20 |
+
predicts = result(user_input)[0]
|
21 |
+
st.markdown("## Probabilities")
|
22 |
+
st.write(f"Predicted: { predicts['label'] } & Score: { predicts['score']}")
|