CoolFace
Apppublic

monib/ITCLUB

sourceHugging Faceotherupdated 3y agoView on Hugging Face
0likes
app.py20 linesDownload Raw Back to root
1import openai2import gradio3 4openai.api_key = "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"5 6messages = [{"role": "system", "content": "You are a chat assistant for the students of bcic college"}]7 8def CustomChatGPT(user_input):9    messages.append({"role": "user", "content": user_input})10    response = openai.ChatCompletion.create(11        model = "gpt-3.5-turbo",12        messages = messages13    )14    ChatGPT_reply = response["choices"][0]["message"]["content"]15    messages.append({"role": "assistant", "content": ChatGPT_reply})16    return ChatGPT_reply17 18demo = gradio.Interface(fn=CustomChatGPT, inputs = "text", outputs = "text", title = "IT Club Assistant")19 20demo.launch()