Upload folder using huggingface_hub
Browse files- chat.py +4 -3
- requirements.txt +2 -1
chat.py
CHANGED
@@ -5,6 +5,8 @@ import gradio as gr
|
|
5 |
import codecs
|
6 |
import base64
|
7 |
import json
|
|
|
|
|
8 |
|
9 |
def login(username, password):
|
10 |
users = json.loads(os.environ.get('users'))
|
@@ -59,9 +61,8 @@ def transcribe(file):
|
|
59 |
def speak(history):
|
60 |
text = history[-1][1]
|
61 |
speech = client.audio.speech.create(model="tts-1", voice="alloy", input=text)
|
62 |
-
|
63 |
-
|
64 |
-
return src
|
65 |
|
66 |
def vote(data: gr.LikeData):
|
67 |
if data.liked:
|
|
|
5 |
import codecs
|
6 |
import base64
|
7 |
import json
|
8 |
+
import soundfile as sf
|
9 |
+
from io import BytesIO
|
10 |
|
11 |
def login(username, password):
|
12 |
users = json.loads(os.environ.get('users'))
|
|
|
61 |
def speak(history):
|
62 |
text = history[-1][1]
|
63 |
speech = client.audio.speech.create(model="tts-1", voice="alloy", input=text)
|
64 |
+
data, sr = sf.read(BytesIO(speech.read()))
|
65 |
+
return sr, data
|
|
|
66 |
|
67 |
def vote(data: gr.LikeData):
|
68 |
if data.liked:
|
requirements.txt
CHANGED
@@ -1 +1,2 @@
|
|
1 |
-
openai
|
|
|
|
1 |
+
openai
|
2 |
+
soundfile
|