mskov commited on
Commit
04abba1
1 Parent(s): 3721bac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -21
app.py CHANGED
@@ -39,26 +39,6 @@ asr_model = whisper.load_model("tiny")
39
 
40
  openai.api_key = os.environ["Openai_APIkey"]
41
 
42
-
43
- # get audio from microphone
44
- with gr.Blocks() as face:
45
-
46
- with gr.Row():
47
- convoState = gr.State([""])
48
- with gr.Column():
49
- audio = gr.Audio(source="microphone", type="filepath")
50
- promptText = gr.Textbox(lines=15, placeholder="Enter a prompt here")
51
- dropChoice = gr.Dropdown(choices=["text-ada-001", "text-davinci-002", "text-davinci-003", "gpt-3.5-turbo"], label="Model")
52
- sliderChoice = gr.Slider(minimum=0.0, maximum=1.0, default=0.8, step=0.1, label="Temperature")
53
- transcribe_btn = gr.Button(value="Transcribe")
54
- with gr.Column():
55
- script = gr.Textbox(label="Transcribed text")
56
- options = gr.Textbox(label="Predictions")
57
- latestConvo = gr.Textbox(label="Running conversation")
58
- #transcribe_btn.click(inference)
59
- transcribe_btn.click(fn=inference, inputs=[audio, promptText, dropChoice, sliderChoice, convoState], outputs=[latestConvo, script, options])
60
- examples = gr.Examples(examples=["Sedan, Truck, SUV", "Dalmaion, Shepherd, Lab, Mutt"], inputs=[options])
61
-
62
 
63
  # Transcribe function
64
  def transcribe(audio_file):
@@ -100,7 +80,24 @@ def inference(audio, prompt, model, temperature, latest):
100
 
101
  return transcript, infers, convoState
102
 
103
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
 
105
 
106
  face.launch()
 
39
 
40
  openai.api_key = os.environ["Openai_APIkey"]
41
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
 
43
  # Transcribe function
44
  def transcribe(audio_file):
 
80
 
81
  return transcript, infers, convoState
82
 
83
+ # get audio from microphone
84
+ with gr.Blocks() as face:
85
+
86
+ with gr.Row():
87
+ convoState = gr.State([""])
88
+ with gr.Column():
89
+ audio = gr.Audio(source="microphone", type="filepath")
90
+ promptText = gr.Textbox(lines=15, placeholder="Enter a prompt here")
91
+ dropChoice = gr.Dropdown(choices=["text-ada-001", "text-davinci-002", "text-davinci-003", "gpt-3.5-turbo"], label="Model")
92
+ sliderChoice = gr.Slider(minimum=0.0, maximum=1.0, default=0.8, step=0.1, label="Temperature")
93
+ transcribe_btn = gr.Button(value="Transcribe")
94
+ with gr.Column():
95
+ script = gr.Textbox(label="Transcribed text")
96
+ options = gr.Textbox(label="Predictions")
97
+ latestConvo = gr.Textbox(label="Running conversation")
98
+ #transcribe_btn.click(inference)
99
+ transcribe_btn.click(fn=inference, inputs=[audio, promptText, dropChoice, sliderChoice, convoState], outputs=[latestConvo, script, options])
100
+ examples = gr.Examples(examples=["Sedan, Truck, SUV", "Dalmaion, Shepherd, Lab, Mutt"], inputs=[options])
101
 
102
 
103
  face.launch()