alexacuff commited on
Commit
f0b30ef
·
1 Parent(s): 983300a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -6
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. 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):
@@ -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(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)
 
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)