Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,7 +6,7 @@ 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.
|
| 10 |
}]
|
| 11 |
|
| 12 |
def call_openai_api(messages):
|
|
@@ -22,21 +22,28 @@ def CustomChatGPT(user_input, messages):
|
|
| 22 |
messages.append({"role": "assistant", "content": ChatGPT_reply})
|
| 23 |
return ChatGPT_reply, messages
|
| 24 |
|
| 25 |
-
def wrapped_chat_gpt(
|
| 26 |
messages = initial_messages.copy()
|
| 27 |
-
user_input = f"I own a
|
| 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.
|
| 35 |
-
gradio.inputs.Textbox(label="
|
|
|
|
|
|
|
|
|
|
| 36 |
],
|
| 37 |
outputs="text",
|
| 38 |
title="Homeowner's Staging Assistant",
|
| 39 |
-
description="
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
)
|
| 41 |
|
| 42 |
demo.launch(inline=False)
|
|
|
|
| 6 |
|
| 7 |
initial_messages = [{
|
| 8 |
"role": "system",
|
| 9 |
+
"content": """You are a Home Staging Assistant designed to assist homeowners. Based on the details of the home and its environment, offer personalized staging recommendations to enhance its appeal to potential buyers. Suggest ideas that highlight the home's unique features and propose cost-effective strategies."""
|
| 10 |
}]
|
| 11 |
|
| 12 |
def call_openai_api(messages):
|
|
|
|
| 22 |
messages.append({"role": "assistant", "content": ChatGPT_reply})
|
| 23 |
return ChatGPT_reply, messages
|
| 24 |
|
| 25 |
+
def wrapped_chat_gpt(type_of_home, number_of_rooms, special_features, city_neighborhood, surrounding_area):
|
| 26 |
messages = initial_messages.copy()
|
| 27 |
+
user_input = f"I own a {type_of_home} with {number_of_rooms} and features like {special_features}. It's located in {city_neighborhood}, which is a {surrounding_area} area. 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.Dropdown(choices=['Condo', 'Townhouse', 'Victorian', 'Bungalow', 'Other'], label="Type of Home"),
|
| 35 |
+
gradio.inputs.Textbox(label="Number of Rooms", placeholder="e.g., 2 bedrooms, 1 living room."),
|
| 36 |
+
gradio.inputs.Textbox(label="Special Features", placeholder="e.g., Fireplace, Backyard Garden."),
|
| 37 |
+
gradio.inputs.Textbox(label="City & Neighborhood", placeholder="e.g., San Francisco's Mission District."),
|
| 38 |
+
gradio.inputs.Dropdown(choices=['Urban', 'Suburban', 'Rural'], label="Surrounding Area")
|
| 39 |
],
|
| 40 |
outputs="text",
|
| 41 |
title="Homeowner's Staging Assistant",
|
| 42 |
+
description="Get personalized staging recommendations for your home. Provide specifics about your home and its environment.",
|
| 43 |
+
examples=[
|
| 44 |
+
["Condo", "2 bedrooms, 1 living room", "Balcony, City View", "New York's Upper East Side", "Urban"],
|
| 45 |
+
["Bungalow", "3 bedrooms, 1 living room", "Backyard Garden, Fireplace", "Portland's Alberta District", "Suburban"]
|
| 46 |
+
] # Adding example inputs to guide users.
|
| 47 |
)
|
| 48 |
|
| 49 |
demo.launch(inline=False)
|