ylacombe HF staff commited on
Commit
c0a7489
1 Parent(s): bfc5e8a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -1,11 +1,14 @@
1
  from __future__ import annotations
2
 
3
  import os
 
 
4
 
5
  import gradio as gr
6
  import numpy as np
7
  import torch
8
  import nltk # we'll use this to split into sentences
 
9
  import uuid
10
  import soundfile as SF
11
 
@@ -31,6 +34,7 @@ this demo is governed by the original [license](https://huggingface.co/spaces/ys
31
  css = """.toast-wrap { display: none !important } """
32
 
33
 
 
34
 
35
  system_message = "\nYou are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature.\n\nIf a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information."
36
  temperature = 0.9
@@ -125,7 +129,7 @@ def generate_speech(history, agree):
125
  for sentence in text_to_generate:
126
  # generate speech by cloning a voice using default settings
127
  wav = tts.tts(text=sentence,
128
- speaker_wav="examples/female.wav",
129
  decoder_iterations=20,
130
  speed=1.2,
131
  language="en")
@@ -148,7 +152,7 @@ with gr.Blocks(title=title) as demo:
148
  chatbot = gr.Chatbot(
149
  [],
150
  elem_id="chatbot",
151
- avatar_images=('examples/lama.jpeg', 'examples/lama2.jpeg'),
152
  bubble_full_width=False,
153
  )
154
 
 
1
  from __future__ import annotations
2
 
3
  import os
4
+ # By using XTTS you agree to CPML license https://coqui.ai/cpml
5
+ os.environ["COQUI_TOS_AGREED"] = "1"
6
 
7
  import gradio as gr
8
  import numpy as np
9
  import torch
10
  import nltk # we'll use this to split into sentences
11
+ nltk.download('punkt')
12
  import uuid
13
  import soundfile as SF
14
 
 
34
  css = """.toast-wrap { display: none !important } """
35
 
36
 
37
+ os.environ["GRADIO_TEMP_DIR"] = "/home/yoach/spaces/tmp"
38
 
39
  system_message = "\nYou are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature.\n\nIf a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information."
40
  temperature = 0.9
 
129
  for sentence in text_to_generate:
130
  # generate speech by cloning a voice using default settings
131
  wav = tts.tts(text=sentence,
132
+ speaker_wav="/home/yoach/spaces/talkWithLLMs/examples/female.wav",
133
  decoder_iterations=20,
134
  speed=1.2,
135
  language="en")
 
152
  chatbot = gr.Chatbot(
153
  [],
154
  elem_id="chatbot",
155
+ avatar_images=('/home/yoach/spaces/talkWithLLMs/examples/lama.jpeg', '/home/yoach/spaces/talkWithLLMs/examples/lama2.jpeg'),
156
  bubble_full_width=False,
157
  )
158