File size: 1,457 Bytes
70947b9
 
86a0a77
70947b9
86a0a77
70947b9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ddd7892
70947b9
 
 
 
 
 
 
440ad32
57cc1f8
 
 
 
 
70947b9
2df795e
70947b9
 
179cb7b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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']))