Spaces:
Sleeping
Sleeping
Try Audio
Browse files- app.py +7 -0
- requirements.txt +1 -0
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
from huggingface_hub import InferenceClient
|
|
|
3 |
|
4 |
"""
|
5 |
For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
@@ -7,6 +8,8 @@ For more information on `huggingface_hub` Inference API support, please check th
|
|
7 |
|
8 |
client = InferenceClient("meta-llama/Meta-Llama-3-8B-Instruct")
|
9 |
|
|
|
|
|
10 |
|
11 |
def respond(
|
12 |
message,
|
@@ -40,6 +43,9 @@ def respond(
|
|
40 |
response += token
|
41 |
yield response
|
42 |
|
|
|
|
|
|
|
43 |
|
44 |
"""
|
45 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
@@ -58,6 +64,7 @@ demo = gr.ChatInterface(
|
|
58 |
label="Top-p (nucleus sampling)",
|
59 |
),
|
60 |
],
|
|
|
61 |
)
|
62 |
|
63 |
|
|
|
1 |
import gradio as gr
|
2 |
from huggingface_hub import InferenceClient
|
3 |
+
from transformers import pipeline
|
4 |
|
5 |
"""
|
6 |
For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
|
|
8 |
|
9 |
client = InferenceClient("meta-llama/Meta-Llama-3-8B-Instruct")
|
10 |
|
11 |
+
tts = pipeline("text-to-speech", model="facebook/tts_transformer-EN-GLACIAL")
|
12 |
+
|
13 |
|
14 |
def respond(
|
15 |
message,
|
|
|
43 |
response += token
|
44 |
yield response
|
45 |
|
46 |
+
audio = tts(response)
|
47 |
+
return response, audio
|
48 |
+
|
49 |
|
50 |
"""
|
51 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
|
|
64 |
label="Top-p (nucleus sampling)",
|
65 |
),
|
66 |
],
|
67 |
+
outputs=[gr.Textbox(), gr.Audio()],
|
68 |
)
|
69 |
|
70 |
|
requirements.txt
CHANGED
@@ -1,3 +1,4 @@
|
|
1 |
huggingface_hub
|
2 |
unsloth
|
3 |
gradio
|
|
|
|
1 |
huggingface_hub
|
2 |
unsloth
|
3 |
gradio
|
4 |
+
transformers
|