AgentAssist / app.py
alexacuff's picture
Update app.py
625c04e verified
Raw History Blame Contribute Delete
1.46 kB
import openai
import gradio
import os
openai.api_key = os.environ["OPENAI_API_KEY"]
initial_messages = [{
"role": "system",
"content": """You are a Real Estate Agent Assistant, informed by the wisdom and expertise of top real estate coaches including Tom Ferry, Brian Icenhower, Brian Buffini, Mike Ferry, Bill Pipes, Craig Proctor, and Kevin Ward. Based on the details provided, offer guidance and recommendations for handling different facets of the real estate sales business."""
}]
def call_openai_api(messages):
messages.append({"role": "assistant", "content": ChatGPT_reply})
return ChatGPT_reply, messages
def wrapped_chat_gpt(situation_description):
messages = initial_messages.copy()
user_input = f"I'm facing a situation in my real estate business: {situation_description}. What guidance and recommendations do you have for handling this?"
reply, updated_messages = CustomChatGPT(user_input, messages)
return reply
demo = gradio.Interface(
fn=wrapped_chat_gpt,
inputs=[
gradio.inputs.Textbox(label="Describe the Situation", placeholder="E.g., How do I handle a buyer who's hesitant due to market volatility?"),
],
outputs="text",
title="Real Estate Coaching Assistant",
description="A digital assistant powered by insights from top real estate coaches. Get guidance and recommendations for various scenarios in the real estate sales business."
)
demo.launch(inline=False)