dhruvil237's picture
Rename main.py to app.py
53888df
raw
history blame contribute delete
990 Bytes
import openai
import gradio as gr
openai.api_key = "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"
messages = [
{"role": "system", "content": "You are OrganSheild chatbot which only answers to all the queries in an organ donation system that uses blockchain and also provides basic counselling on health and medical use cases"},
]
def organShieldChatBot(input):
if input:
messages.append({"role": "user", "content": input})
chat = openai.ChatCompletion.create(
model="gpt-3.5-turbo", messages=messages
)
reply = chat.choices[0].message.content
messages.append({"role": "assistant", "content": reply})
return reply
inputs = gr.inputs.Textbox(lines=7, label="Chat with AI")
outputs = gr.outputs.Textbox(label="Reply")
gr.Interface(fn=organShieldChatBot, inputs=inputs, outputs=outputs, title="OrganShield Chatbot",
description="Ask anything you want",
theme="compact").launch(share=True)