Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,10 @@ import whisper
|
|
2 |
import gradio as gr
|
3 |
import openai
|
4 |
import os
|
5 |
-
|
|
|
|
|
|
|
6 |
|
7 |
import whisper
|
8 |
import gradio as gr
|
@@ -42,16 +45,35 @@ with demo:
|
|
42 |
b1 = gr.Button("Transcribe audio")
|
43 |
b2 = gr.Button("Process text")
|
44 |
|
45 |
-
|
46 |
-
|
47 |
text1 = gr.Textbox()
|
48 |
text2 = gr.Textbox()
|
49 |
|
|
|
50 |
b1.click(transcribe, inputs=audio, outputs=text1)
|
51 |
b2.click(process_text, inputs=text1, outputs=text2)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
|
53 |
|
54 |
-
demo.launch(
|
55 |
|
56 |
# 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.
|
57 |
|
|
|
2 |
import gradio as gr
|
3 |
import openai
|
4 |
import os
|
5 |
+
|
6 |
+
openai.api_key = os.environ["OPENAI_API_KEY"]
|
7 |
+
|
8 |
+
#openai.api_key = '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'
|
9 |
|
10 |
import whisper
|
11 |
import gradio as gr
|
|
|
45 |
b1 = gr.Button("Transcribe audio")
|
46 |
b2 = gr.Button("Process text")
|
47 |
|
48 |
+
|
|
|
49 |
text1 = gr.Textbox()
|
50 |
text2 = gr.Textbox()
|
51 |
|
52 |
+
|
53 |
b1.click(transcribe, inputs=audio, outputs=text1)
|
54 |
b2.click(process_text, inputs=text1, outputs=text2)
|
55 |
+
|
56 |
+
prompt = f"""
|
57 |
+
You are a world class nurse practitioner. You are provided with text delimited by triple quotes. \
|
58 |
+
Summarize the text and put it in a table format with rows as follows: \
|
59 |
+
|
60 |
+
1. Patient identification:
|
61 |
+
2. Chief complaint:
|
62 |
+
3. Medical history:
|
63 |
+
4. Family history:
|
64 |
+
5. Social history:
|
65 |
+
6. Review of systems:
|
66 |
+
7. Current medications:
|
67 |
+
8. Vaccination status:
|
68 |
+
9. Emotional well-being:
|
69 |
+
10. Patient concerns and expectations:
|
70 |
+
|
71 |
+
\"\"\"{text1}\"\"\"
|
72 |
+
"""
|
73 |
+
|
74 |
|
75 |
|
76 |
+
demo.launch()
|
77 |
|
78 |
# 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.
|
79 |
|