cc / app.py
Eduarr's picture
Create app.py
ab42f21
raw
history blame contribute delete
902 Bytes
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:coloncancer-2023-09-20-01-05-16",
prompt=prompt,
max_tokens=30,
temperature=0,
stop=["_END"]
)
return response.choices[0].text.strip()
iface = gr.Interface(fn=generate_completion,
inputs=gr.inputs.Textbox(lines=5, placeholder='write the phrase here'),
outputs='text',
title="Colon cancer symptom detector",
description="Colon cancer symptom detector. Write the phrase and add the arrow -> plus three spaces, example: Unexplained weight loss -> ",
input_labels="phrase",
output_labels="prediction")
iface.launch()