binqiangliu commited on
Commit
4cdfeed
1 Parent(s): 71f569a

Upload folder using huggingface_hub

Browse files
Files changed (7) hide show
  1. .env +1 -0
  2. .gitattributes +1 -0
  3. README.md +0 -1
  4. app.py +3 -6
  5. flagged/log.csv +2 -0
  6. requirements.txt +1 -3
  7. response.mp3 +3 -0
.env ADDED
@@ -0,0 +1 @@
 
 
1
+ OPENAI_API_KEY="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"
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ response.mp3 filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -1,6 +1,5 @@
1
  ---
2
  title: VoiceChatbot
3
- python_version: 3.11.4
4
  app_file: app.py
5
  sdk: gradio
6
  sdk_version: 3.34.0
 
1
  ---
2
  title: VoiceChatbot
 
3
  app_file: app.py
4
  sdk: gradio
5
  sdk_version: 3.34.0
app.py CHANGED
@@ -3,12 +3,11 @@
3
  #pip install pyttsx3
4
  #pip install pydantic
5
  #pip install openai gradio pyttsx3 pydantic
 
6
 
7
  import gradio as gr
8
  import openai
9
  import pyttsx3
10
- #import python-espeak
11
- #from gtts import gTTS
12
  #import pydantic
13
 
14
  from dotenv import load_dotenv
@@ -20,7 +19,7 @@ openai.api_key = os.getenv("OPENAI_API_KEY")
20
 
21
  # Global variable to hold the chat history, initialise with system role
22
  conversation = [
23
- {"role": "system", "content": "You are a helpful assistant."}
24
  ]
25
 
26
  # transcribe function to record the audio input
@@ -57,8 +56,6 @@ def transcribe(audio):
57
 
58
  # Text to speech
59
  engine = pyttsx3.init()
60
- # engine = pyttsx3.init('espeak')
61
- # engine.setProperty('engine', 'gTTS')
62
  engine.setProperty("rate", 150)
63
  engine.setProperty("voice", "english-us")
64
  engine.save_to_file(system_message, "response.mp3")
@@ -69,6 +66,6 @@ def transcribe(audio):
69
  # Gradio output
70
 
71
  bot = gr.Interface(fn=transcribe, inputs=gr.Audio(source="microphone", type="filepath"), outputs="audio")
72
- bot.launch(share=False)
73
 
74
  iface.share()
 
3
  #pip install pyttsx3
4
  #pip install pydantic
5
  #pip install openai gradio pyttsx3 pydantic
6
+ #pip install python-dotenv
7
 
8
  import gradio as gr
9
  import openai
10
  import pyttsx3
 
 
11
  #import pydantic
12
 
13
  from dotenv import load_dotenv
 
19
 
20
  # Global variable to hold the chat history, initialise with system role
21
  conversation = [
22
+ {"role": "system", "content": "You are an intelligent professor."}
23
  ]
24
 
25
  # transcribe function to record the audio input
 
56
 
57
  # Text to speech
58
  engine = pyttsx3.init()
 
 
59
  engine.setProperty("rate", 150)
60
  engine.setProperty("voice", "english-us")
61
  engine.save_to_file(system_message, "response.mp3")
 
66
  # Gradio output
67
 
68
  bot = gr.Interface(fn=transcribe, inputs=gr.Audio(source="microphone", type="filepath"), outputs="audio")
69
+ bot.launch(share=True)
70
 
71
  iface.share()
flagged/log.csv ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ audio,output,flag,username,timestamp
2
+ ,,,,2023-07-04 03:30:51.207212
requirements.txt CHANGED
@@ -1,6 +1,4 @@
1
  openai
2
  gradio
3
- #pyttsx
4
  pyttsx3
5
- python-dotenv
6
- #python-espeak
 
1
  openai
2
  gradio
 
3
  pyttsx3
4
+ python-dotenv
 
response.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9f11924e8a95e28a8e376cf00cff3c4edb19c6f96243d9d0e22b6cb625bf54b6
3
+ size 1304548