jqtrde dawood HF staff commited on
Commit
e00c24c
0 Parent(s):

Duplicate from gradio/NYC-Airbnb-Map

Browse files

Co-authored-by: dawood <dawood@users.noreply.huggingface.co>

Files changed (5) hide show
  1. .gitattributes +31 -0
  2. AB_NYC_2019.csv +0 -0
  3. README.md +14 -0
  4. app.py +53 -0
  5. requirements.txt +2 -0
.gitattributes ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ftz filter=lfs diff=lfs merge=lfs -text
6
+ *.gz filter=lfs diff=lfs merge=lfs -text
7
+ *.h5 filter=lfs diff=lfs merge=lfs -text
8
+ *.joblib filter=lfs diff=lfs merge=lfs -text
9
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
10
+ *.model filter=lfs diff=lfs merge=lfs -text
11
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
12
+ *.npy filter=lfs diff=lfs merge=lfs -text
13
+ *.npz filter=lfs diff=lfs merge=lfs -text
14
+ *.onnx filter=lfs diff=lfs merge=lfs -text
15
+ *.ot filter=lfs diff=lfs merge=lfs -text
16
+ *.parquet filter=lfs diff=lfs merge=lfs -text
17
+ *.pickle filter=lfs diff=lfs merge=lfs -text
18
+ *.pkl filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pt filter=lfs diff=lfs merge=lfs -text
21
+ *.pth filter=lfs diff=lfs merge=lfs -text
22
+ *.rar filter=lfs diff=lfs merge=lfs -text
23
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
24
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
25
+ *.tflite filter=lfs diff=lfs merge=lfs -text
26
+ *.tgz filter=lfs diff=lfs merge=lfs -text
27
+ *.wasm filter=lfs diff=lfs merge=lfs -text
28
+ *.xz filter=lfs diff=lfs merge=lfs -text
29
+ *.zip filter=lfs diff=lfs merge=lfs -text
30
+ *.zst filter=lfs diff=lfs merge=lfs -text
31
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
AB_NYC_2019.csv ADDED
The diff for this file is too large to render. See raw diff
 
README.md ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: NYC Airbnb Map
3
+ emoji: 🏃
4
+ colorFrom: purple
5
+ colorTo: indigo
6
+ sdk: gradio
7
+ sdk_version: 3.8.2
8
+ app_file: app.py
9
+ pinned: false
10
+ license: apache-2.0
11
+ duplicated_from: gradio/NYC-Airbnb-Map
12
+ ---
13
+
14
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import pandas as pd
3
+ import plotly.graph_objects as go
4
+
5
+ df = pd.read_csv("AB_NYC_2019.csv")
6
+
7
+ def filter_map(min_price, max_price, boroughs):
8
+
9
+ filtered_df = df[(df['neighbourhood_group'].isin(boroughs)) &
10
+ (df['price'] > min_price) & (df['price'] < max_price)]
11
+ names = filtered_df["name"].tolist()
12
+ prices = filtered_df["price"].tolist()
13
+ text_list = [(names[i], prices[i]) for i in range(0, len(names))]
14
+ fig = go.Figure(go.Scattermapbox(
15
+ customdata=text_list,
16
+ lat=filtered_df['latitude'].tolist(),
17
+ lon=filtered_df['longitude'].tolist(),
18
+ mode='markers',
19
+ marker=go.scattermapbox.Marker(
20
+ size=6
21
+ ),
22
+ hoverinfo="text",
23
+ hovertemplate='<b>Name</b>: %{customdata[0]}<br><b>Price</b>: $%{customdata[1]}'
24
+ ))
25
+
26
+ fig.update_layout(
27
+ mapbox_style="open-street-map",
28
+ hovermode='closest',
29
+ mapbox=dict(
30
+ bearing=0,
31
+ center=go.layout.mapbox.Center(
32
+ lat=40.67,
33
+ lon=-73.90
34
+ ),
35
+ pitch=0,
36
+ zoom=9
37
+ ),
38
+ )
39
+
40
+ return fig
41
+
42
+ with gr.Blocks() as demo:
43
+ with gr.Column():
44
+ with gr.Row():
45
+ min_price = gr.Number(value=250, label="Minimum Price")
46
+ max_price = gr.Number(value=1000, label="Maximum Price")
47
+ boroughs = gr.CheckboxGroup(choices=["Queens", "Brooklyn", "Manhattan", "Bronx", "Staten Island"], value=["Queens", "Brooklyn"], label="Select Boroughs:")
48
+ btn = gr.Button(value="Update Filter")
49
+ map = gr.Plot().style()
50
+ demo.load(filter_map, [min_price, max_price, boroughs], map)
51
+ btn.click(filter_map, [min_price, max_price, boroughs], map)
52
+
53
+ demo.launch()
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ plotly
2
+ pandas