textToSQL commited on
Commit
f304c9c
·
1 Parent(s): 8f8b684

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -22
app.py CHANGED
@@ -5,11 +5,6 @@ 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
12
-
13
  model = whisper.load_model("small")
14
 
15
  def transcribe(audio):
@@ -38,7 +33,29 @@ def process_text(input_text):
38
  return output_text
39
 
40
  def get_completion(prompt, model='gpt-3.5-turbo'):
41
- messages = [{"role": "user", "content": prompt}]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  response = openai.ChatCompletion.create(
43
  model = model,
44
  messages = messages,
@@ -59,30 +76,16 @@ with demo:
59
  text1 = gr.Textbox()
60
  text2 = gr.Textbox()
61
 
62
- prompt = f"""
63
- You are a world class nurse practitioner. You are provided with the transcription. \
64
- Summarize the text and put it in a table format with rows as follows: \
65
-
66
- 1. Patient identification:
67
- 2. Chief complaint:
68
- 3. Medical history:
69
- 4. Family history:
70
- 5. Social history:
71
- 6. Review of systems:
72
- 7. Current medications:
73
- 8. Vaccination status:
74
- 9. Emotional well-being:
75
- 10. Patient concerns and expectations:
76
 
77
 
78
- """
79
 
80
  b1.click(transcribe, inputs=audio, outputs=text1)
81
  b2.click(get_completion, inputs=text1, outputs=text2)
82
 
83
 
84
  # b1.click(transcribe, inputs=audio, outputs=text1)
85
- # b2.click(get_completion, inputs=text1, outputs=text2)
86
 
87
 
88
 
 
5
 
6
  openai.api_key = os.environ["OPENAI_API_KEY"]
7
 
 
 
 
 
 
8
  model = whisper.load_model("small")
9
 
10
  def transcribe(audio):
 
33
  return output_text
34
 
35
  def get_completion(prompt, model='gpt-3.5-turbo'):
36
+ messages = [
37
+ {"role": "system", "content": """You are a world class nurse practitioner. You are provided with the transcription. \
38
+ Summarize the text and put it in a table format with rows as follows: \
39
+
40
+ Date of Alert
41
+ Claimant
42
+ Client/Employer
43
+ Claim #
44
+ DOI (Date of Injury)
45
+ Date of Visit
46
+ Provider
47
+ Diagnosis Treated
48
+ Subjective findings
49
+ Objective Findings
50
+ Treatment plan
51
+ Medications
52
+ RTW (Return to Work) Status
53
+ Restrictions
54
+ NOV (Next Office Visit)
55
+ """
56
+ },
57
+ {"role": "user", "content": prompt}
58
+ ]
59
  response = openai.ChatCompletion.create(
60
  model = model,
61
  messages = messages,
 
76
  text1 = gr.Textbox()
77
  text2 = gr.Textbox()
78
 
79
+ prompt = text1
 
 
 
 
 
 
 
 
 
 
 
 
 
80
 
81
 
 
82
 
83
  b1.click(transcribe, inputs=audio, outputs=text1)
84
  b2.click(get_completion, inputs=text1, outputs=text2)
85
 
86
 
87
  # b1.click(transcribe, inputs=audio, outputs=text1)
88
+ # b2.click(get_completion, inputs=prompt, outputs=text2)
89
 
90
 
91