Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -89,13 +89,28 @@ def generate_soap(
|
|
89 |
outputs.append(text)
|
90 |
yield "".join(outputs)
|
91 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
# Gradio Interface combining transcription and SOAP note generation
|
93 |
demo = gr.Blocks(theme=gr.themes.Ocean())
|
94 |
|
95 |
with demo:
|
96 |
with gr.Tab("Clinical SOAP Note from Audio"):
|
97 |
audio_transcribe_and_soap = gr.Interface(
|
98 |
-
fn=
|
99 |
inputs=[
|
100 |
gr.Audio(sources=["microphone", "upload"], type="filepath", label="Audio Input"),
|
101 |
gr.Radio(["transcribe", "translate"], label="Task", value="transcribe"),
|
|
|
89 |
outputs.append(text)
|
90 |
yield "".join(outputs)
|
91 |
|
92 |
+
# Combine transcription and SOAP generation
|
93 |
+
def transcribe_and_generate_soap(audio, task, system_prompt, max_new_tokens, temperature, top_p, top_k, repetition_penalty):
|
94 |
+
# First transcribe the audio
|
95 |
+
transcribed_text = transcribe(audio, task)
|
96 |
+
# Then generate SOAP notes based on the transcription
|
97 |
+
return generate_soap(
|
98 |
+
transcribed_text,
|
99 |
+
system_prompt,
|
100 |
+
max_new_tokens,
|
101 |
+
temperature,
|
102 |
+
top_p,
|
103 |
+
top_k,
|
104 |
+
repetition_penalty
|
105 |
+
)
|
106 |
+
|
107 |
# Gradio Interface combining transcription and SOAP note generation
|
108 |
demo = gr.Blocks(theme=gr.themes.Ocean())
|
109 |
|
110 |
with demo:
|
111 |
with gr.Tab("Clinical SOAP Note from Audio"):
|
112 |
audio_transcribe_and_soap = gr.Interface(
|
113 |
+
fn=transcribe_and_generate_soap,
|
114 |
inputs=[
|
115 |
gr.Audio(sources=["microphone", "upload"], type="filepath", label="Audio Input"),
|
116 |
gr.Radio(["transcribe", "translate"], label="Task", value="transcribe"),
|