Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,22 +1,33 @@
|
|
| 1 |
-
from transformers import pipeline
|
| 2 |
-
|
| 3 |
import gradio as gr
|
| 4 |
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
if __name__ == "__main__":
|
| 22 |
demo.launch()
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
+
# Text to Speech Interface
|
| 4 |
+
tts_title = "Text to Speech Translation"
|
| 5 |
+
tts_examples = [
|
| 6 |
+
"I love learning machine learning",
|
| 7 |
+
"How do you do?",
|
| 8 |
+
]
|
| 9 |
+
tts_demo = gr.Interface.load(
|
| 10 |
+
"huggingface/facebook/fastspeech2-en-ljspeech",
|
| 11 |
+
title=tts_title,
|
| 12 |
+
examples=tts_examples,
|
| 13 |
+
description="Give me something to say!",
|
| 14 |
+
)
|
| 15 |
+
|
| 16 |
+
# Sentiment Analysis Interface
|
| 17 |
+
sentiment_title = "Sentiment Analysis"
|
| 18 |
+
sentiment_examples = [
|
| 19 |
+
"I love learning machine learning",
|
| 20 |
+
"How do you do?",
|
| 21 |
+
]
|
| 22 |
+
sentiment_demo = gr.Interface.load(
|
| 23 |
+
"huggingface/nlp-sentiment-analysis",
|
| 24 |
+
title=sentiment_title,
|
| 25 |
+
examples=sentiment_examples,
|
| 26 |
+
description="Analyze the sentiment of the text!",
|
| 27 |
+
)
|
| 28 |
+
|
| 29 |
+
# Tabbed Interface
|
| 30 |
+
demo = gr.TabbedInterface([tts_demo, sentiment_demo], ["Text to Speech", "Sentiment Analysis"])
|
| 31 |
|
| 32 |
if __name__ == "__main__":
|
| 33 |
demo.launch()
|