Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import openai
|
| 3 |
+
def generate_completion(user_prompt):
|
| 4 |
+
hidden_context = " "
|
| 5 |
+
prompt = hidden_context + user_prompt
|
| 6 |
+
response = openai.Completion.create(
|
| 7 |
+
model="davinci:ft-topwow-llc:gastrictumor-2023-09-15-02-11-18",
|
| 8 |
+
prompt=prompt,
|
| 9 |
+
max_tokens=10,
|
| 10 |
+
temperature=0
|
| 11 |
+
)
|
| 12 |
+
return response.choices[0].text.strip()
|
| 13 |
+
iface = gr.Interface(fn=generate_completion,
|
| 14 |
+
inputs=gr.inputs.Textbox(lines=5, placeholder='Escribe aquí la frase o las palabras que le dijo su potencial cliente'),
|
| 15 |
+
outputs='text',
|
| 16 |
+
title="Detector of potential symptoms of gastric cancer",
|
| 17 |
+
description=" Platform that detects potential symptoms of gastric tumor. Write the phrase and add the arrow -> plus three spaces, example: I have intense pain in the pit of my stomach -> ",
|
| 18 |
+
)
|
| 19 |
+
iface.launch()
|