Vishaltiwari2019 commited on
Commit
d1bb585
·
verified ·
1 Parent(s): bbadfc1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -14
app.py CHANGED
@@ -1,30 +1,40 @@
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
- # Sentiment Analysis
5
- sentiment = pipeline("sentiment-analysis")
6
-
7
- def get_sentiment(input_text):
8
- return sentiment(input_text)
 
 
 
 
9
 
10
- iface_sentiment = gr.Interface(get_sentiment, inputs="text", outputs="text", title="Sentiment Analysis")
 
 
 
 
 
11
 
12
  # Text to Speech Translation
13
- tts_title = "Text to Speech Translation"
14
- tts_examples = [
15
  "I love learning machine learning",
16
  "How do you do?",
17
  ]
18
 
19
- tts_demo = gr.Interface.load(
20
  "huggingface/facebook/fastspeech2-en-ljspeech",
21
- title=tts_title,
22
- examples=tts_examples,
23
  description="Give me something to say!",
24
  )
25
 
26
- # Launching both interfaces
27
- demo = gr.TabbedInterface([iface_sentiment, tts_demo], ["Sentiment Analysis", "Text to Speech"])
28
 
29
  if __name__ == "__main__":
30
- demo.launch()
 
 
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
+ # Emotion Text Classification
5
+ title_emotion = "Classify text according to emotion"
6
+ description_emotion = "Emotion text classification via bert-base finetuned by bhadresh-savani"
7
+ examples_emotion = [
8
+ ["Remember before Twitter when you took a photo of food, got the film developed, then drove around showing everyone the pic? No? Me neither."],
9
+ ['''"We are all here because we're committed to the biggest question of all: What's out there?" Take your first steps toward answering that question by watching our Gameplay Reveal from the #XboxBethesda Showcase. '''],
10
+ ["A STUNNER IN KNOXVILLE! 😱 Notre Dame takes down No. 1 Tennessee for its first trip to Omaha in 20 years‼️"],
11
+ ["you and I best moment is yet to come 💜 #BTS9thAnniversary"]
12
+ ]
13
 
14
+ interface_emotion = gr.Interface.load(
15
+ "huggingface/bhadresh-savani/bert-base-go-emotion",
16
+ title=title_emotion,
17
+ description=description_emotion,
18
+ examples=examples_emotion
19
+ )
20
 
21
  # Text to Speech Translation
22
+ title_tts = "Text to Speech Translation"
23
+ examples_tts = [
24
  "I love learning machine learning",
25
  "How do you do?",
26
  ]
27
 
28
+ interface_tts = gr.Interface.load(
29
  "huggingface/facebook/fastspeech2-en-ljspeech",
30
+ title=title_tts,
31
+ examples=examples_tts,
32
  description="Give me something to say!",
33
  )
34
 
35
+ # Launching both interfaces with tabs
36
+ demo = gr.TabbedInterface([interface_emotion, interface_tts], ["Emotion Classification", "Text to Speech"])
37
 
38
  if __name__ == "__main__":
39
+ demo.launch(share=True, enable_queue=True)
40
+