File size: 718 Bytes
2f9f9d9
322922b
b976ff0
322922b
 
b976ff0
322922b
 
 
 
 
 
52fe9f8
322922b
 
60ae5e6
322922b
60ae5e6
322922b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import gradio as gr
from fastai.vision.all import *

# Load the model
learn = load_learner('sentimentality.h5')

# Prediction function
def make_prediction(user_sentence):
  
  prediction = learn.predict(user_sentence)
  dict = {'1': 'Negative', '2': 'Neutral', '3': 'Positive'}
  return dict[prediction[0]]

title = "Sentiment Analysis MyAnimeList Reviews with fastai"
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>"

app = gr.Interface(fn=make_prediction, title=title, description=description, inputs=gr.TextArea(), outputs='text')

app.launch()