Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,12 +4,10 @@ import os
|
|
| 4 |
|
| 5 |
openai.api_key = os.environ["OPENAI_API_KEY"]
|
| 6 |
|
| 7 |
-
initial_messages = [{
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
4. Recommend items that are easily accessible and cost-effective for the agent.
|
| 12 |
-
5. Reply to the user with a list of recommended items and strategies for staging the home. Include brief explanations for each recommendation."""}]
|
| 13 |
|
| 14 |
def call_openai_api(messages):
|
| 15 |
return openai.ChatCompletion.create(
|
|
@@ -26,19 +24,19 @@ def CustomChatGPT(user_input, messages):
|
|
| 26 |
|
| 27 |
def wrapped_chat_gpt(home_details, location):
|
| 28 |
messages = initial_messages.copy()
|
| 29 |
-
user_input = f"I
|
| 30 |
reply, updated_messages = CustomChatGPT(user_input, messages)
|
| 31 |
return reply
|
| 32 |
|
| 33 |
demo = gradio.Interface(
|
| 34 |
fn=wrapped_chat_gpt,
|
| 35 |
inputs=[
|
| 36 |
-
gradio.inputs.Textbox(label="Home Details", placeholder="Describe the home
|
| 37 |
-
gradio.inputs.Textbox(label="Location", placeholder="Enter the
|
| 38 |
],
|
| 39 |
outputs="text",
|
| 40 |
-
title="
|
| 41 |
-
description="This tool
|
| 42 |
)
|
| 43 |
|
| 44 |
demo.launch(inline=False)
|
|
|
|
| 4 |
|
| 5 |
openai.api_key = os.environ["OPENAI_API_KEY"]
|
| 6 |
|
| 7 |
+
initial_messages = [{
|
| 8 |
+
"role": "system",
|
| 9 |
+
"content": """You are a Home Staging Assistant designed to assist homeowners. Upon receiving details about the home and its location, provide tailored recommendations for staging the property to maximize its appeal to potential buyers. Suggest strategies that emphasize the home's unique features and offer cost-effective solutions."""
|
| 10 |
+
}]
|
|
|
|
|
|
|
| 11 |
|
| 12 |
def call_openai_api(messages):
|
| 13 |
return openai.ChatCompletion.create(
|
|
|
|
| 24 |
|
| 25 |
def wrapped_chat_gpt(home_details, location):
|
| 26 |
messages = initial_messages.copy()
|
| 27 |
+
user_input = f"I own a home described as: {home_details}. It's located in {location}. How should I stage it to attract potential buyers?"
|
| 28 |
reply, updated_messages = CustomChatGPT(user_input, messages)
|
| 29 |
return reply
|
| 30 |
|
| 31 |
demo = gradio.Interface(
|
| 32 |
fn=wrapped_chat_gpt,
|
| 33 |
inputs=[
|
| 34 |
+
gradio.inputs.Textbox(label="Home Details", placeholder="Describe the home: e.g., 3-bedroom Victorian with a backyard."),
|
| 35 |
+
gradio.inputs.Textbox(label="Location", placeholder="Enter the location or neighborhood: e.g., San Francisco's Mission District."),
|
| 36 |
],
|
| 37 |
outputs="text",
|
| 38 |
+
title="Homeowner's Staging Assistant",
|
| 39 |
+
description="This tool offers homeowners AI-driven staging recommendations to make their homes more appealing to potential buyers. Provide your home's features and its location, and receive personalized suggestions."
|
| 40 |
)
|
| 41 |
|
| 42 |
demo.launch(inline=False)
|