Roberto8 commited on
Commit
69103ac
1 Parent(s): 1bbb1ea

Upload 3 files

Browse files
Files changed (3) hide show
  1. app.py +20 -0
  2. export.pkl +3 -0
  3. requirements.txt +1 -0
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from fastai.vision.all import *
3
+
4
+ # Load the model
5
+ learn = load_learner('export.pkl')
6
+
7
+ # Prediction function
8
+ def make_prediction(user_sentence):
9
+
10
+ prediction = learn.predict(user_sentence)
11
+ dict = {1: 'Negative', 2: 'Neutral', 3: 'Positive'}
12
+ return dict[prediction]
13
+
14
+ title = "Sentiment Analysis MyAnimeList Reviews with fastai"
15
+ description = "<p style='text-align: center'>Identifier si un commentaire dans MyAnimeList est positif, neutre ou négatif.<br/> Permet de connaître rapidement le sentiment globale que dégage un avis sur le site.</p>"
16
+ examples = ["I liked this show but now I do not love this since the last season. The animation is terrible and the drawings are awful. I don't recommend this show to anyone.", "This is amazing !"]
17
+
18
+ app = gr.Interface(fn=make_prediction, title=title, description=description, examples=examples, inputs=gr.TextArea(), outputs='text')
19
+
20
+ app.launch()
export.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a0674881477460e3e25db0ad44f493c3b9589c38c82abf0a5bc34b9671a642e4
3
+ size 144990323
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ fastai