Spaces:
Runtime error
Runtime error
Update TextGen/router.py
Browse files- TextGen/router.py +28 -28
TextGen/router.py
CHANGED
@@ -9,7 +9,7 @@ from langchain.chains import LLMChain
|
|
9 |
from langchain.prompts import PromptTemplate
|
10 |
from TextGen.suno import custom_generate_audio, get_audio_information,generate_lyrics
|
11 |
from TextGen.diffusion import generate_image
|
12 |
-
from coqui import predict
|
13 |
from langchain_google_genai import (
|
14 |
ChatGoogleGenerativeAI,
|
15 |
HarmBlockThreshold,
|
@@ -189,33 +189,33 @@ def generate_voice_eleven(message: VoiceMessage = None):
|
|
189 |
yield chunk
|
190 |
|
191 |
return StreamingResponse(audio_stream(), media_type="audio/mpeg")
|
192 |
-
|
193 |
-
|
194 |
-
def generate_voice_coqui(message: VoiceMessage = None):
|
195 |
-
global Last_message
|
196 |
-
if message is None:
|
197 |
-
message = Last_message
|
198 |
-
else:
|
199 |
-
Last_message = message
|
200 |
-
|
201 |
-
def audio_stream():
|
202 |
-
voice = determine_vocie_from_npc(message.npc, message.genre)
|
203 |
-
result = predict(
|
204 |
-
prompt=message.input,
|
205 |
-
language=message.language,
|
206 |
-
audio_file_pth=voice,
|
207 |
-
mic_file_path=None,
|
208 |
-
use_mic=False,
|
209 |
-
voice_cleanup=False,
|
210 |
-
no_lang_auto_detect=False,
|
211 |
-
agree=True,
|
212 |
-
)
|
213 |
-
# Generate the audio stream from ElevenLabs
|
214 |
-
for chunk in result:
|
215 |
-
print("received : ",chunk)
|
216 |
-
yield chunk
|
217 |
-
|
218 |
-
return StreamingResponse(audio_stream(),media_type="audio/mpeg")
|
219 |
@app.get("/generate_song")
|
220 |
async def generate_song():
|
221 |
text="""You are a bard in a video game singing the tales of a little girl in red hood."""
|
|
|
9 |
from langchain.prompts import PromptTemplate
|
10 |
from TextGen.suno import custom_generate_audio, get_audio_information,generate_lyrics
|
11 |
from TextGen.diffusion import generate_image
|
12 |
+
#from coqui import predict
|
13 |
from langchain_google_genai import (
|
14 |
ChatGoogleGenerativeAI,
|
15 |
HarmBlockThreshold,
|
|
|
189 |
yield chunk
|
190 |
|
191 |
return StreamingResponse(audio_stream(), media_type="audio/mpeg")
|
192 |
+
#@app.get("/generate_voice_coqui", response_class=StreamingResponse)
|
193 |
+
#@app.post("/generate_voice_coqui", response_class=StreamingResponse)
|
194 |
+
#def generate_voice_coqui(message: VoiceMessage = None):
|
195 |
+
# global Last_message
|
196 |
+
# if message is None:
|
197 |
+
# message = Last_message
|
198 |
+
# else:
|
199 |
+
# Last_message = message
|
200 |
+
#
|
201 |
+
# def audio_stream():
|
202 |
+
# voice = determine_vocie_from_npc(message.npc, message.genre)
|
203 |
+
# result = predict(
|
204 |
+
# prompt=message.input,
|
205 |
+
# language=message.language,
|
206 |
+
# audio_file_pth=voice,
|
207 |
+
# mic_file_path=None,
|
208 |
+
# use_mic=False,
|
209 |
+
# voice_cleanup=False,
|
210 |
+
# no_lang_auto_detect=False,
|
211 |
+
# agree=True,
|
212 |
+
# )
|
213 |
+
# # Generate the audio stream from ElevenLabs
|
214 |
+
# for chunk in result:
|
215 |
+
# print("received : ",chunk)
|
216 |
+
# yield chunk#
|
217 |
+
#
|
218 |
+
# return StreamingResponse(audio_stream(),media_type="audio/mpeg")
|
219 |
@app.get("/generate_song")
|
220 |
async def generate_song():
|
221 |
text="""You are a bard in a video game singing the tales of a little girl in red hood."""
|