snaramirez872 commited on
Commit
46837a8
·
1 Parent(s): ec1f12c

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -0
app.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
9
+ result = pipeline("sentiment-analysis", model=mod)
10
+
11
+ st.title("Gibberish Detector")
12
+
13
+ user_input = str(st.text_input("Enter some words", "pasghetti"))
14
+
15
+
16
+ # result = classifier(["This is a sample text made by Sean Ramirez.", "This is another sample text."]) # leftover from initial testing
17
+
18
+ if user_input:
19
+ predicts = result(user_input)[0]
20
+ st.markdown("## Probabilities")
21
+ st.write(f"Predicted: { predicts['label'] } & Score: { predicts['score']}")