CKD-AI-Chatbot / app.py
naughtondale's picture
Update app.py
179cb7b
import gradio as gr
import openai
import os
openai.api_key = os.environ.get('openai_api_key')
def chatbot(input):
prompt = """You only answer questions about Chronic Kidney Disease (CKD). If the question is not about CKD, you politely respond that you are not designed to answer that kind of question.\n\n""" + input
response = openai.Completion.create(
engine="text-davinci-003",
prompt=prompt,
temperature=0.5,
max_tokens=1000
)
return response.choices[0].text.strip()
iface = gr.Interface(
fn=chatbot,
inputs="text",
outputs="text",
theme = gr.themes.Monochrome(
primary_hue="blue",
secondary_hue="blue",
neutral_hue="blue",
),
title="Chronic Kidney Disease AI Chatbot",
description="""This AI chatbot is designed to answer questions about Chronic Kidney Disease (CKD). Ask about the symptoms, treatments, research advances, or any other CKD-related queries.
Not sure what to ask? Try questions like these:
- "What is the latest research on CKD?"
- "What are the symptoms of CKD?"
- "Can you explain how dialysis works?"
<br>
<br>Go back to: <a href="https://aitechproducts.com/healthcare-products.html">Healthcare AI Samples</a>""",
custom_css="""
.gradio-interface {
background-image: url('logo.png');
background-repeat: no-repeat;
background-size: cover;
}
""",
)
iface.launch(auth=(os.environ['USERNAME1'],os.environ['PASSWORD1']))