Update app.py
Browse files
app.py
CHANGED
@@ -1,32 +1,13 @@
|
|
1 |
|
2 |
-
from
|
3 |
-
|
4 |
-
from transformers import pipeline, Conversation
|
5 |
import gradio as gr
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
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)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|