jlsotoh commited on
Commit
46d260b
1 Parent(s): 1e9bb11
Files changed (2) hide show
  1. app.py +14 -6
  2. requirements.txt +1 -0
app.py CHANGED
@@ -2,7 +2,8 @@
2
  import whisper
3
  import gradio as gr
4
  import time
5
- from pyChatGPT import ChatGPT
 
6
  import warnings
7
 
8
  """Variables"""
@@ -38,11 +39,18 @@ def transcribe(audio):
38
  result_text = 'How is Michael Jordan?' # result.text
39
 
40
  # Pass the generated text to audio
41
- chatgpt_api = ChatGPT(secret_token)
42
- resp = chatgpt_api.send_message(result_text)
43
- out_result = resp['message']
44
-
45
- return [result_text, out_result]
 
 
 
 
 
 
 
46
 
47
 
48
  """Gradio Interface"""
 
2
  import whisper
3
  import gradio as gr
4
  import time
5
+ # from pyChatGPT import ChatGPT
6
+ import openai
7
  import warnings
8
 
9
  """Variables"""
 
39
  result_text = 'How is Michael Jordan?' # result.text
40
 
41
  # Pass the generated text to audio
42
+ # chatgpt_api = ChatGPT(secret_token)
43
+ # resp = chatgpt_api.send_message(result_text)
44
+ # out_result = resp['message']
45
+
46
+ openai.api_key = secret_token
47
+ response = openai.Completion.create(
48
+ engine="text-davinci-003",
49
+ prompt=result_text,
50
+ max_tokens=1024
51
+ )
52
+ result = response["choices"][0]["text"]
53
+ return [result_text, result]
54
 
55
 
56
  """Gradio Interface"""
requirements.txt CHANGED
@@ -1,5 +1,6 @@
1
  git+https://github.com/openai/whisper.git
2
  gradio
 
3
  pyChatGPT
4
  PyVirtualDisplay
5
  transformers
 
1
  git+https://github.com/openai/whisper.git
2
  gradio
3
+ openai
4
  pyChatGPT
5
  PyVirtualDisplay
6
  transformers