textToSQL commited on
Commit
c279ea6
·
1 Parent(s): 08fbba1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -5
app.py CHANGED
@@ -37,6 +37,16 @@ def process_text(input_text):
37
  output_text = input_text.upper()
38
  return output_text
39
 
 
 
 
 
 
 
 
 
 
 
40
  demo = gr.Blocks()
41
 
42
  with demo:
@@ -49,10 +59,6 @@ with demo:
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: \
@@ -71,7 +77,14 @@ with demo:
71
  \"\"\"{text1}\"\"\"
72
  """
73
 
74
-
 
 
 
 
 
 
 
75
 
76
  demo.launch()
77
 
 
37
  output_text = input_text.upper()
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,
45
+ temperature = 0,
46
+
47
+ )
48
+ return response.choices[0].message['content']
49
+
50
  demo = gr.Blocks()
51
 
52
  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 text delimited by triple quotes. \
64
  Summarize the text and put it in a table format with rows as follows: \
 
77
  \"\"\"{text1}\"\"\"
78
  """
79
 
80
+ b1.click(transcribe, inputs=audio, outputs=text1)
81
+ b2.click(get_completion, outputs=text2)
82
+
83
+
84
+ # b1.click(transcribe, inputs=audio, outputs=text1)
85
+ # b2.click(get_completion, inputs=prompt, outputs=text2)
86
+
87
+
88
 
89
  demo.launch()
90