Spaces:
Build error
Build error
Update app.py
Browse filesAsk question button / text set to visible
app.py
CHANGED
|
@@ -18,17 +18,6 @@ pipe = pipeline(
|
|
| 18 |
device=device,
|
| 19 |
)
|
| 20 |
|
| 21 |
-
@spaces.GPU
|
| 22 |
-
def audio_transcribe(inputs, task):
|
| 23 |
-
if inputs is None:
|
| 24 |
-
raise gr.Error("No audio file submitted! Please upload or record an audio file before submitting your request.")
|
| 25 |
-
|
| 26 |
-
text = pipe(inputs, batch_size=BATCH_SIZE, generate_kwargs={"task": task}, return_timestamps=True)["text"]
|
| 27 |
-
transcriberUI.ask_question.visible = True
|
| 28 |
-
transcriberUI.submit_question.visible = True
|
| 29 |
-
|
| 30 |
-
return text
|
| 31 |
-
|
| 32 |
@spaces.GPU
|
| 33 |
def respond_to_question(transcript, question):
|
| 34 |
# Optionally, use OpenAI API to generate a response to the user's question
|
|
@@ -61,6 +50,17 @@ with gr.Blocks() as transcriberUI:
|
|
| 61 |
response_output = gr.Textbox(label="Response", visible=False)
|
| 62 |
submit_question = gr.Button("Submit question", visible=False)
|
| 63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
def ask_question_callback():
|
| 65 |
if ask_question.value:
|
| 66 |
response = respond_to_question(transcript_output.value, ask_question.value)
|
|
|
|
| 18 |
device=device,
|
| 19 |
)
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
@spaces.GPU
|
| 22 |
def respond_to_question(transcript, question):
|
| 23 |
# Optionally, use OpenAI API to generate a response to the user's question
|
|
|
|
| 50 |
response_output = gr.Textbox(label="Response", visible=False)
|
| 51 |
submit_question = gr.Button("Submit question", visible=False)
|
| 52 |
|
| 53 |
+
@spaces.GPU
|
| 54 |
+
def audio_transcribe(inputs, task):
|
| 55 |
+
if inputs is None:
|
| 56 |
+
raise gr.Error("No audio file submitted! Please upload or record an audio file before submitting your request.")
|
| 57 |
+
|
| 58 |
+
text = pipe(inputs, batch_size=BATCH_SIZE, generate_kwargs={"task": task}, return_timestamps=True)["text"]
|
| 59 |
+
ask_question.visible = True
|
| 60 |
+
submit_question.visible = True
|
| 61 |
+
|
| 62 |
+
return text
|
| 63 |
+
|
| 64 |
def ask_question_callback():
|
| 65 |
if ask_question.value:
|
| 66 |
response = respond_to_question(transcript_output.value, ask_question.value)
|