| import gradio as gr | |
| import openai | |
| def generate_completion(user_prompt): | |
| hidden_context = " " | |
| prompt = hidden_context + user_prompt | |
| response = openai.Completion.create( | |
| model="davinci:ft-topwow-llc:gastrictumor-2023-09-15-02-11-18", | |
| prompt=prompt, | |
| max_tokens=10, | |
| temperature=0 | |
| ) | |
| return response.choices[0].text.strip() | |
| iface = gr.Interface(fn=generate_completion, | |
| inputs=gr.inputs.Textbox(lines=5, placeholder=''), | |
| outputs='text', | |
| title="Detector of potential symptoms of gastric cancer", | |
| 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 -> ", | |
| ) | |
| iface.launch() |