commonman commited on
Commit
74c0e97
·
1 Parent(s): 7a86365

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -3,7 +3,7 @@
3
  import os
4
  import gradio as gr
5
  import openai
6
- from gtts import gTTS # Google Text To Speech
7
 
8
  # load the api key
9
  openai.api_key = os.environ["OPEN_AI_KEY"]
@@ -26,7 +26,7 @@ def transcribe(audio):
26
  with gr.Blocks() as demo:
27
  gr.Markdown(
28
  """
29
- # Rescriber: The Reflection Transcriber
30
  """
31
  )
32
  with gr.Accordion("Click for Instructions:"):
@@ -43,7 +43,7 @@ with gr.Blocks() as demo:
43
  # First message as instructions to OpenAI
44
  # Establishes a State object to create a
45
  # unique state for each user and on reload
46
- messages = gr.State(value=[{"role": "system", "content": "Return the following text verbatim, with one change: Put bold markdown markup (**) around a few of the central ideas in the text. Follow the text with a short bulleted summary of the text, in the first person."}])
47
 
48
  # Takes the users transcribed audio as a string
49
  # Takes the messages list as a reference
@@ -101,15 +101,15 @@ with gr.Blocks() as demo:
101
  user_audio = gr.Audio(source="microphone", type="filepath", label="Record reflection")
102
  submit_btn = gr.Button(value="Transcribe Audio")
103
  submit_btn2 = gr.Button(value="Submit Text")
104
- gpt_voice = gr.Audio(label="Play Voice")
105
  with gr.Column(scale=2):
106
  user_transcript = gr.Text(label="Transcription", interactive=False)
107
  user_text = gr.Text(label="Text Input")
108
- gpt_transcript = gr.Text(label="With main points highlighted and final summary.")
109
  submit_btn.click(transcribe, user_audio, user_transcript)
110
  submit_btn2.click(botResponse, [user_text, messages], gpt_transcript)
111
  user_transcript.change(botResponse, [user_transcript, messages], gpt_transcript)
112
- gpt_transcript.change(giveVoice, messages, gpt_voice)
113
 
114
 
115
  # creates a local web server
 
3
  import os
4
  import gradio as gr
5
  import openai
6
+ ## from gtts import gTTS # Google Text To Speech
7
 
8
  # load the api key
9
  openai.api_key = os.environ["OPEN_AI_KEY"]
 
26
  with gr.Blocks() as demo:
27
  gr.Markdown(
28
  """
29
+ # Adam's Transcriber
30
  """
31
  )
32
  with gr.Accordion("Click for Instructions:"):
 
43
  # First message as instructions to OpenAI
44
  # Establishes a State object to create a
45
  # unique state for each user and on reload
46
+ messages = gr.State(value=[{"role": "system", "content": "Return the following text exactly as given, but bold markdown markup (**) around a few of the central ideas in the text. Follow the text with a short bulleted summary of the text. If the text is in the first person, the summary should be in the first person as well."}])
47
 
48
  # Takes the users transcribed audio as a string
49
  # Takes the messages list as a reference
 
101
  user_audio = gr.Audio(source="microphone", type="filepath", label="Record reflection")
102
  submit_btn = gr.Button(value="Transcribe Audio")
103
  submit_btn2 = gr.Button(value="Submit Text")
104
+ ## gpt_voice = gr.Audio(label="Play Voice")
105
  with gr.Column(scale=2):
106
  user_transcript = gr.Text(label="Transcription", interactive=False)
107
  user_text = gr.Text(label="Text Input")
108
+ gpt_transcript = gr.Text(label="GPT Processed version (main points highlighted and final summary).")
109
  submit_btn.click(transcribe, user_audio, user_transcript)
110
  submit_btn2.click(botResponse, [user_text, messages], gpt_transcript)
111
  user_transcript.change(botResponse, [user_transcript, messages], gpt_transcript)
112
+ ## gpt_transcript.change(giveVoice, messages, gpt_voice)
113
 
114
 
115
  # creates a local web server