Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,30 +1,40 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
4 |
-
#
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
|
|
|
|
|
|
|
|
9 |
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
# Text to Speech Translation
|
13 |
-
|
14 |
-
|
15 |
"I love learning machine learning",
|
16 |
"How do you do?",
|
17 |
]
|
18 |
|
19 |
-
|
20 |
"huggingface/facebook/fastspeech2-en-ljspeech",
|
21 |
-
title=
|
22 |
-
examples=
|
23 |
description="Give me something to say!",
|
24 |
)
|
25 |
|
26 |
-
# Launching both interfaces
|
27 |
-
demo = gr.TabbedInterface([
|
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 |
+
|