Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -91,6 +91,7 @@ def transcribe(asr_inputs, task):
|
|
91 |
|
92 |
audio_input = gr.Audio(sources=["upload", "microphone"], type="filepath", label="Audio Input Source")
|
93 |
task_input_choice = gr.Radio(["transcribe", "translate"], label="Task", value="transcribe")
|
|
|
94 |
|
95 |
transcribe_interface = gr.Interface(
|
96 |
fn=transcribe,
|
@@ -99,7 +100,8 @@ transcribe_interface = gr.Interface(
|
|
99 |
#audio_input_choice,
|
100 |
task_input_choice,
|
101 |
],
|
102 |
-
outputs=
|
|
|
103 |
title=application_title,
|
104 |
description=application_description,
|
105 |
allow_flagging="never",
|
@@ -110,8 +112,8 @@ transcribe_interface = gr.Interface(
|
|
110 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
111 |
"""
|
112 |
chatbot_main = gr.Chatbot(label="Extraction Output")
|
113 |
-
chatbot_sys_output = gr.Textbox(value="You are a friendly Chatbot.", label="System
|
114 |
-
chatbot_max_tokens = gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max
|
115 |
chatbot_temperature = gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature")
|
116 |
chatbot_top_p = gr.Slider(
|
117 |
minimum=0.1,
|
@@ -140,19 +142,19 @@ with gr.Blocks() as demo:
|
|
140 |
"""
|
141 |
def clear_audio_input():
|
142 |
return None
|
143 |
-
|
144 |
-
def
|
145 |
-
if
|
146 |
-
return gr.
|
147 |
-
elif
|
148 |
-
return gr.
|
149 |
|
150 |
-
#
|
151 |
-
|
152 |
-
inputs=
|
153 |
-
outputs=
|
154 |
)
|
155 |
-
|
156 |
|
157 |
if __name__ == "__main__":
|
158 |
demo.queue().launch() #demo.launch()
|
|
|
91 |
|
92 |
audio_input = gr.Audio(sources=["upload", "microphone"], type="filepath", label="Audio Input Source")
|
93 |
task_input_choice = gr.Radio(["transcribe", "translate"], label="Task", value="transcribe")
|
94 |
+
task_output = gr.Textbox(label="Transcribed Output")
|
95 |
|
96 |
transcribe_interface = gr.Interface(
|
97 |
fn=transcribe,
|
|
|
100 |
#audio_input_choice,
|
101 |
task_input_choice,
|
102 |
],
|
103 |
+
outputs=[
|
104 |
+
task_output, #"text",
|
105 |
title=application_title,
|
106 |
description=application_description,
|
107 |
allow_flagging="never",
|
|
|
112 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
113 |
"""
|
114 |
chatbot_main = gr.Chatbot(label="Extraction Output")
|
115 |
+
chatbot_sys_output = gr.Textbox(value="You are a friendly Chatbot.", label="System Message")
|
116 |
+
chatbot_max_tokens = gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max. New Tokens")
|
117 |
chatbot_temperature = gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature")
|
118 |
chatbot_top_p = gr.Slider(
|
119 |
minimum=0.1,
|
|
|
142 |
"""
|
143 |
def clear_audio_input():
|
144 |
return None
|
145 |
+
"""
|
146 |
+
def update_task_input(task_input_choice):
|
147 |
+
if task_input_choice == "transcribe":
|
148 |
+
return gr.Textbox(label="Transcribed Output") #Audio(sources="upload", label="Audio: from file")
|
149 |
+
elif task_input_choice == "translate":
|
150 |
+
return gr.Textbox(label="Translated Output") #Audio(sources="microphone", label="Audio: from microphone")
|
151 |
|
152 |
+
#task_input_choice.input(fn=clear_audio_input, outputs=audio_input).then(fn=update_audio_input,
|
153 |
+
task_input_choice.input(fn=update_task_input,
|
154 |
+
inputs=task_input_choice,
|
155 |
+
outputs=task_output
|
156 |
)
|
157 |
+
|
158 |
|
159 |
if __name__ == "__main__":
|
160 |
demo.queue().launch() #demo.launch()
|