Emmanuel08 commited on
Commit
df57892
·
verified ·
1 Parent(s): 2036131

Create app.py

Browse files

This is a feedback model, it is used to become

Files changed (1) hide show
  1. app.py +23 -0
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+ import gradio as gr
3
+
4
+ classifier = pipeline("text-classification", model="tabularisai/multilingual-sentiment-analysis")
5
+
6
+ #Load sentiment analysis pipeline
7
+ # classifier_pipeline = pipeline("text-classification", model="tabularisai/multilingual-sentiment-analysis")
8
+ # Define classification function
9
+
10
+ def classify_text(text):
11
+ output = classifier_pipeline(text)
12
+ return output[0] # Extract the first result from the list
13
+
14
+ # Define Gradio interface
15
+ interface = gr.Interface(
16
+ fn=classify_text,
17
+ inputs=gr.Textbox(label="Enter sentence here"),
18
+ outputs=gr.Label(),
19
+ examples=["I am hungry", "I love this product!", "This is the worst experience ever."]
20
+ )
21
+
22
+ # Launch the interface
23
+ interface.launch()