Spaces:
Sleeping
Sleeping
Commit
·
aa71662
1
Parent(s):
ecfa5f9
fixed up categories
Browse files- app.py +21 -0
- model.pkl +3 -0
- requirements.txt +19 -0
app.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import fastai
|
3 |
+
import skimage
|
4 |
+
from fastai.vision.all import *
|
5 |
+
|
6 |
+
learn=load_learner('model.pkl')
|
7 |
+
|
8 |
+
categories=('negative','positive')
|
9 |
+
|
10 |
+
def classify(img):
|
11 |
+
pred,idx,probs=learn.predict(img)
|
12 |
+
return dict(zip(categories, map(float,probs)))
|
13 |
+
|
14 |
+
|
15 |
+
title = "Text sentiment classifier"
|
16 |
+
description = "This model classifies a sentence of text as having a positive or negative setiment"
|
17 |
+
text = gr.TextBox()
|
18 |
+
label= gr.Label()
|
19 |
+
|
20 |
+
intf=gr.Interface(fn=classify,inputs=text,outputs=label,title=title, description=description)
|
21 |
+
intf.launch(inline=False)
|
model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:94913b9204bae8a28630ad3d28d62dbf2beff010f4c50e52451d53ced36ac879
|
3 |
+
size 233513283
|
requirements.txt
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
fastai==2.7.13
|
2 |
+
fastbook==0.0.29
|
3 |
+
fastcore==1.5.29
|
4 |
+
fastdownload==0.0.7
|
5 |
+
fastprogress==1.0.3
|
6 |
+
gradio==3.50.0
|
7 |
+
graphviz==0.20.1
|
8 |
+
ipywidgets==7.7.1
|
9 |
+
matplotlib==3.7.4
|
10 |
+
numpy==1.24.3
|
11 |
+
pandas==2.0.3
|
12 |
+
requests==2.31.0
|
13 |
+
scipy==1.11.4
|
14 |
+
sentencepiece==0.1.99
|
15 |
+
session_info==1.0.0
|
16 |
+
scikit-learn==1.2.2
|
17 |
+
torch==2.0.0
|
18 |
+
torchvision==0.15.1
|
19 |
+
scikit-image
|