textToSQL commited on
Commit
84d3dde
·
1 Parent(s): 0956aae

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -11
app.py CHANGED
@@ -29,15 +29,37 @@ def transcribe(audio):
29
  return result.text
30
 
31
 
32
-
33
- gr.Interface(
34
- title = 'OpenAI Whisper ASR Gradio Web UI',
35
- fn=transcribe,
36
- inputs=[
37
- gr.inputs.Audio(source="microphone", type="filepath")
38
- ],
39
- outputs=[
40
- "textbox"
41
- ],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
 
43
- live=True).launch()
 
29
  return result.text
30
 
31
 
32
+ def process_text(input_text):
33
+ # Apply your function here to process the input text
34
+ output_text = input_text.upper()
35
+ return output_text
36
+
37
+ demo = gr.Blocks()
38
+
39
+ with demo:
40
+ audio = gr.Audio(type="filepath")
41
+ text1 = gr.Textbox()
42
+ text2 = gr.Textbox()
43
+
44
+ b1 = gr.Button("Transcribe audio")
45
+ b2 = gr.Button("Process text")
46
+
47
+ b1.click(transcribe, inputs=audio, outputs=text1)
48
+ b2.click(process_text, inputs=text1, outputs=text2)
49
+
50
+ demo.launch()
51
+
52
+ # In this example, the process_text function just converts the input text to uppercase, but you can replace it with your desired function. The Gradio Blocks interface will have two buttons: "Transcribe audio" and "Process text". The first button transcribes the audio and fills the first textbox, and the second button processes the text from the first textbox and fills the second textbox.
53
+
54
+
55
+ # gr.Interface(
56
+ # title = 'OpenAI Whisper ASR Gradio Web UI',
57
+ # fn=transcribe,
58
+ # inputs=[
59
+ # gr.inputs.Audio(source="microphone", type="filepath")
60
+ # ],
61
+ # outputs=[
62
+ # "textbox"
63
+ # ],
64
 
65
+ # live=True).launch()