Spaces:
Paused
Paused
Commit
·
95a9653
1
Parent(s):
f43a6b0
Dutch
Browse files- discourse.py +6 -4
discourse.py
CHANGED
@@ -10,6 +10,8 @@ DATA_FILENAME = "data.txt"
|
|
10 |
DATA_FILE = os.path.join("data", DATA_FILENAME)
|
11 |
HF_TOKEN = os.environ.get("HF_TOKEN")
|
12 |
|
|
|
|
|
13 |
repo = Repository(
|
14 |
local_dir="data", clone_from=DATASET_REPO_URL, use_auth_token=HF_TOKEN
|
15 |
)
|
@@ -20,13 +22,13 @@ speech_config = speechsdk.SpeechConfig(subscription=os.environ['AZURE_SPEECH_KEY
|
|
20 |
speech_config.speech_synthesis_voice_name = "nl-NL-ColetteNeural"
|
21 |
speech_synthesizer = speechsdk.SpeechSynthesizer(speech_config=speech_config, audio_config=None)
|
22 |
|
23 |
-
context = [{"role": "system", "content": '
|
24 |
-
|
25 |
-
|
26 |
|
27 |
def transcribe(model: str, audio: str):
|
28 |
audio_file = open(audio, "rb")
|
29 |
-
transcript = openai.Audio.transcribe(model, audio_file)
|
30 |
return transcript
|
31 |
|
32 |
def gen_response(model: str, context: list):
|
|
|
10 |
DATA_FILE = os.path.join("data", DATA_FILENAME)
|
11 |
HF_TOKEN = os.environ.get("HF_TOKEN")
|
12 |
|
13 |
+
LANGUAGE = "nl"
|
14 |
+
|
15 |
repo = Repository(
|
16 |
local_dir="data", clone_from=DATASET_REPO_URL, use_auth_token=HF_TOKEN
|
17 |
)
|
|
|
22 |
speech_config.speech_synthesis_voice_name = "nl-NL-ColetteNeural"
|
23 |
speech_synthesizer = speechsdk.SpeechSynthesizer(speech_config=speech_config, audio_config=None)
|
24 |
|
25 |
+
context = [{"role": "system", "content": 'Je bent een slimme en behulpzame gesprekspartner. \
|
26 |
+
Antwoord beknopt en ter zake.\
|
27 |
+
Vermeld niet dat je een AI of een soort service bent.'}]
|
28 |
|
29 |
def transcribe(model: str, audio: str):
|
30 |
audio_file = open(audio, "rb")
|
31 |
+
transcript = openai.Audio.transcribe(model, audio_file, language=LANGUAGE)
|
32 |
return transcript
|
33 |
|
34 |
def gen_response(model: str, context: list):
|