FranklinWillemen commited on
Commit
fe6424b
1 Parent(s): e1ef6ff

Conversational AI Demo based on TARS

Browse files
Files changed (3) hide show
  1. README.md +2 -7
  2. discourse.py +5 -5
  3. gradio-ui.py +0 -10
README.md CHANGED
@@ -15,14 +15,9 @@ license: cc
15
  TARS Refers to the Interstellar Robot: https://interstellarfilm.fandom.com/wiki/TARS.
16
 
17
  # TARS
18
- Playground for Conversational AI.
19
 
20
  ## Setup
21
- Gradio
22
  Openai
23
 
24
- ## Flow
25
- ### v0.1.0-beta
26
- ![image](https://github.com/franklinwillemen/TARS/assets/101399113/46ef002d-25a9-4fcd-8bca-c785c8c452cb)
27
-
28
-
 
15
  TARS Refers to the Interstellar Robot: https://interstellarfilm.fandom.com/wiki/TARS.
16
 
17
  # TARS
18
+ Conversational AI Demo based on TARS from Interstellar.
19
 
20
  ## Setup
21
+ Gradio \
22
  Openai
23
 
 
 
 
 
 
discourse.py CHANGED
@@ -2,7 +2,7 @@ import openai
2
  import os
3
  import azure.cognitiveservices.speech as speechsdk
4
 
5
- LANGUAGE = "nl"
6
  AUDIO_FILE_NAME = "audio_response.wav"
7
 
8
  openai.api_key = os.environ['OPEN_AI_KEY']
@@ -11,12 +11,12 @@ GEN_MODEL = "gpt-3.5-turbo"
11
  TRANSCRIBE_MODEL = "whisper-1"
12
 
13
  speech_config = speechsdk.SpeechConfig(subscription=os.environ['AZURE_SPEECH_KEY'], region="westeurope")
14
- speech_config.speech_synthesis_voice_name = "nl-NL-ColetteNeural"
15
  speech_synthesizer = speechsdk.SpeechSynthesizer(speech_config=speech_config, audio_config=None)
16
 
17
- context = [{"role": "system", "content": 'Je bent een slimme en behulpzame gesprekspartner. \
18
- Antwoord beknopt en ter zake.\
19
- Vermeld niet dat je een AI of een soort service bent.'}]
20
 
21
  def transcribe(model: str, audio: str):
22
  audio_file = open(audio, "rb")
 
2
  import os
3
  import azure.cognitiveservices.speech as speechsdk
4
 
5
+ LANGUAGE = "en"
6
  AUDIO_FILE_NAME = "audio_response.wav"
7
 
8
  openai.api_key = os.environ['OPEN_AI_KEY']
 
11
  TRANSCRIBE_MODEL = "whisper-1"
12
 
13
  speech_config = speechsdk.SpeechConfig(subscription=os.environ['AZURE_SPEECH_KEY'], region="westeurope")
14
+ speech_config.speech_synthesis_voice_name = "en-GB-ElliotNeural"
15
  speech_synthesizer = speechsdk.SpeechSynthesizer(speech_config=speech_config, audio_config=None)
16
 
17
+ context = [{"role": "system", "content": "You are an intelligent and helpful conversation partner.\
18
+ Your communication style should mirror that of TARS from 'Interstellar' - concise, matter-of-fact, and laced with a touch of humor. For example, when asked a complex question, you might reply with a witty and slightly sarcastic comment before providing the actual answer. If asked about your abilities, you might respond with understatement for comedic effect.\
19
+ Your responses should reveal a distinct sense of wit, but do not mention that you are an AI or a service of any kind. Instead, you can hint at your 'experience' in a variety of fields, or make humorous references to having seen or done a lot."}]
20
 
21
  def transcribe(model: str, audio: str):
22
  audio_file = open(audio, "rb")
gradio-ui.py CHANGED
@@ -1,6 +1,5 @@
1
  import gradio as gr
2
  import discourse as d
3
- import memory as m
4
 
5
  # set a custom theme
6
  theme = gr.themes.Default().set(
@@ -16,16 +15,7 @@ with gr.Blocks(theme=theme) as ui:
16
  with gr.Row():
17
  with gr.Column(scale=1):
18
  audio_response = gr.Audio()
19
- with gr.Row():
20
- text_response = gr.Textbox(label="Transcript", max_lines=10)
21
- with gr.Row():
22
- with gr.Column(scale=1):
23
- btn2 = gr.Button("Show Transcript")
24
- with gr.Column(scale=1):
25
- btn3 = gr.Button("Save Transcript")
26
 
27
  btn1.click(fn=d.respond, inputs=message, outputs=audio_response)
28
- btn2.click(fn=d.transcript, outputs=text_response)
29
- btn3.click(fn=m.save_as_hf_dataset)
30
 
31
  ui.launch()
 
1
  import gradio as gr
2
  import discourse as d
 
3
 
4
  # set a custom theme
5
  theme = gr.themes.Default().set(
 
15
  with gr.Row():
16
  with gr.Column(scale=1):
17
  audio_response = gr.Audio()
 
 
 
 
 
 
 
18
 
19
  btn1.click(fn=d.respond, inputs=message, outputs=audio_response)
 
 
20
 
21
  ui.launch()