ntam0001 commited on
Commit
784af7f
1 Parent(s): a8f9355

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -12
app.py CHANGED
@@ -2,12 +2,6 @@ import gradio as gr
2
  import pickle
3
  import json
4
  import numpy as np
5
- import pandas as pd
6
-
7
- def clear_default_value(val):
8
- if val == "0":
9
- return ""
10
- return val
11
 
12
  # Load model and columns
13
  with open("kigali_model.pickle", "rb") as f:
@@ -64,11 +58,11 @@ def predict(size_sqm, number_of_bedrooms, number_of_bathrooms, number_of_floors,
64
 
65
  # Define Gradio interface components
66
  inputs = [
67
- gr.Textbox(label="Size (sqm)", value="0", interactive=True).change(fn=lambda x: clear_default_value(x)),
68
- gr.Textbox(label="Number of Bedrooms", value="0", interactive=True).change(fn=lambda x: clear_default_value(x)),
69
- gr.Textbox(label="Number of Bathrooms", value="0", interactive=True).change(fn=lambda x: clear_default_value(x)),
70
- gr.Textbox(label="Number of Floors", value="0", interactive=True).change(fn=lambda x: clear_default_value(x)),
71
- gr.Textbox(label="Parking Space", value="0", interactive=True).change(fn=lambda x: clear_default_value(x)),
72
  gr.Dropdown(choices=list(location_mapping.keys()), label="Location"),
73
  gr.Dropdown(choices=list(property_type_mapping.keys()), label="Property Type")
74
  ]
@@ -86,4 +80,4 @@ gr.Interface(
86
  title="Property Price Prediction in Kigali City @2024",
87
  description="Enter property details to get the price prediction.",
88
  article=footer
89
- ).launch()
 
2
  import pickle
3
  import json
4
  import numpy as np
 
 
 
 
 
 
5
 
6
  # Load model and columns
7
  with open("kigali_model.pickle", "rb") as f:
 
58
 
59
  # Define Gradio interface components
60
  inputs = [
61
+ gr.Textbox(label="Size (sqm)", placeholder="Enter size in sqm"),
62
+ gr.Textbox(label="Number of Bedrooms", placeholder="Enter number of bedrooms"),
63
+ gr.Textbox(label="Number of Bathrooms", placeholder="Enter number of bathrooms"),
64
+ gr.Textbox(label="Number of Floors", placeholder="Enter number of floors"),
65
+ gr.Textbox(label="Parking Space", placeholder="Enter parking space availability"),
66
  gr.Dropdown(choices=list(location_mapping.keys()), label="Location"),
67
  gr.Dropdown(choices=list(property_type_mapping.keys()), label="Property Type")
68
  ]
 
80
  title="Property Price Prediction in Kigali City @2024",
81
  description="Enter property details to get the price prediction.",
82
  article=footer
83
+ ).launch(share=True)