Eduarr commited on
Commit
423161c
·
1 Parent(s): 6474784

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -0
app.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import openai
3
+ import os
4
+
5
+ openai.api_key = os.getenv("OPENAI_API_KEY")
6
+
7
+ def generate_completion(user_prompt):
8
+ hidden_context = " "
9
+ prompt = hidden_context + user_prompt
10
+ response = openai.Completion.create(
11
+ model="davinci:ft-topwow-llc:braintumor-2023-08-30-01-15-51",
12
+ prompt=prompt,
13
+ max_tokens=30,
14
+ temperature=0,
15
+ stop=["_END"]
16
+ )
17
+ return response.choices[0].text.strip()
18
+ iface = gr.Interface(fn=generate_completion,
19
+ inputs=gr.inputs.Textbox(lines=5, placeholder=' Insert the arrow -> after the description of the symptom, for example "I have a bad headache at night ->"'),
20
+ outputs='text',
21
+ title="Brain tumor",
22
+ description="Platform to detect potential brain tumor symptoms, does not replace medical professionals. ",
23
+ input_labels="Phrases",
24
+ output_labels="symptoms")
25
+ iface.launch()