Aansh123 commited on
Commit
667f8be
1 Parent(s): b8afe39

Upload gradio.py

Browse files
Files changed (1) hide show
  1. gradio.py +20 -0
gradio.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Before running this program, install gradio and transformers
2
+
3
+ from transformers import pipeline
4
+ import gradio as gr
5
+
6
+ model = "Aansh123/test_trainer"
7
+ classifier = pipeline("Classification", model = model)
8
+
9
+ def classification(sentence):
10
+ return classifier(sentence)[0]['text-classification']
11
+
12
+ iface = gr.Interface(
13
+ fn = classification,
14
+ inputs = gr.inputs.Textbox(label="Input your Review"),
15
+ outputs = gr.outputs.Textbox(label="Rating"),
16
+ title = "Review Rating",
17
+ description = "Sentiment Analysis of Review and provision of final Ratings using a fine-tuned model."
18
+ )
19
+
20
+ iface.launch()