Commit
·
da3aba1
1
Parent(s):
b503d3b
add model.pkl
Browse files- app.py +21 -0
- flagged/log.csv +2 -0
- model.pkl +3 -0
app.py
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from joblib import load
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
model = load('model.pkl')
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
def predict_sentiment(text: str)-> str:
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
sentiment_map = {
|
| 12 |
+
-1: 'Negative',
|
| 13 |
+
0: 'Neutral',
|
| 14 |
+
1: 'Positive'
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
prediction = model.predict([text])[0]
|
| 18 |
+
return sentiment_map[prediction]
|
| 19 |
+
|
| 20 |
+
demo = gr.Interface(fn=predict_sentiment, inputs="text", outputs="text")
|
| 21 |
+
demo.launch()
|
flagged/log.csv
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
text,output,flag,username,timestamp
|
| 2 |
+
,Neutral,,,2024-09-08 20:14:35.183702
|
model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:44ed68e32ead5f00587f82409258ba1dd75d1b1e384af8596e12de581cfc73a4
|
| 3 |
+
size 11996610
|