Aashi1 commited on
Commit
2de9011
·
verified ·
1 Parent(s): 71a156e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -30
app.py CHANGED
@@ -1,32 +1,13 @@
1
 
2
- from tqdm import tqdm
3
-
4
- from transformers import pipeline, Conversation
5
  import gradio as gr
6
- # defining classifier
7
- classifier = pipeline(task="sentiment-analysis", model="distilbert-base-uncased-finetuned-sst-2-english")
8
-
9
- # we can also pass in a list to classifier
10
-
11
- # classifier("Wow, it's happening")
12
-
13
- text_list = ["This is great", \
14
- "Thanks for nothing", \
15
- "You've got to work on your face", \
16
- "You're beautiful, never change!"]
17
-
18
- classifier(text_list)
19
- # if there are multiple target labels, we can return them all
20
- classifier = pipeline(task="text-classification", model="SamLowe/roberta-base-go_emotions", top_k=None)
21
- summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
22
- message_list = []
23
- response_list = []
24
-
25
- def vanilla_chatbot(message, history):
26
- conversation = chatbot(message)
27
-
28
- return conversation[0]['generated_text']
29
-
30
- demo_chatbot = gr.ChatInterface(vanilla_chatbot, title="Vanilla Chatbot", description="Enter text to start chatting.")
31
-
32
- demo_chatbot.launch(inline=False)
 
1
 
2
+ from transformers import pipeline
 
 
3
  import gradio as gr
4
+ sentiment =pipeline("sentiment-analysis")
5
+ def get_sentiment(input_text):
6
+ return sentiment(input_text)
7
+
8
+ iface= gr.interface(fn = get_sentiment,
9
+ inputs ="text",
10
+ outputs =['text'],
11
+ title ='Sentiment Analysis',
12
+ description = 'Get Sentiment Negative/Positive for the given input')
13
+ iface.launch(inline=False)