CoolFace
Apppublic

slomah/SAC

sourceHugging Faceopenrailupdated 3y agoView on Hugging Face
0likes
app.py24 linesDownload Raw Back to root
1import os2 3os.system('pip install -e ./openai')4#pip install openai5import openai6#import gradio7 8openai.api_key = "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"9 10messages = [{"role": "system", "content": "You are a financial experts that specializes in real estate investment and negotiation"}]11 12def CustomChatGPT(user_input):13    messages.append({"role": "user", "content": user_input})14    response = openai.ChatCompletion.create(15        model = "gpt-3.5-turbo",16        messages = messages17    )18    ChatGPT_reply = response["choices"][0]["message"]["content"]19    messages.append({"role": "assistant", "content": ChatGPT_reply})20    return ChatGPT_reply21 22demo = gradio.Interface(fn=CustomChatGPT, inputs = "text", outputs = "text", title = "Real Estate Pro")23 24demo.launch(share=True)