Spaces:
Sleeping
Sleeping
Duplicate from ljrmary/UT_Hackathon
Browse filesCo-authored-by: Linjing Rao <ljrmary@users.noreply.huggingface.co>
- .gitattributes +35 -0
- README.md +13 -0
- app.py +84 -0
- zone_data.geojson +0 -0
- zone_table.csv +9 -0
.gitattributes
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: UT Hackathon
|
| 3 |
+
emoji: 🐢
|
| 4 |
+
colorFrom: green
|
| 5 |
+
colorTo: pink
|
| 6 |
+
sdk: gradio
|
| 7 |
+
sdk_version: 3.39.0
|
| 8 |
+
app_file: app.py
|
| 9 |
+
pinned: false
|
| 10 |
+
duplicated_from: ljrmary/UT_Hackathon
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import requests
|
| 3 |
+
import geopandas as gpd
|
| 4 |
+
from shapely.geometry import Point
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def process_input(address, selected_option, additional_input):
|
| 8 |
+
transport_analysis_needed = selected_option in [
|
| 9 |
+
"Residential",
|
| 10 |
+
"Office",
|
| 11 |
+
"Community Facility",
|
| 12 |
+
]
|
| 13 |
+
|
| 14 |
+
output_address = f"You entered the address:\n{address}"
|
| 15 |
+
output_option = f"Selected option:\n{selected_option}"
|
| 16 |
+
|
| 17 |
+
response = requests.get(
|
| 18 |
+
f"https://geosearch.planninglabs.nyc/v2/autocomplete?text={address}"
|
| 19 |
+
)
|
| 20 |
+
data = response.json()
|
| 21 |
+
x = data["features"][0]["geometry"]["coordinates"]
|
| 22 |
+
|
| 23 |
+
# Load the GeoJSON file into a GeoDataFrame
|
| 24 |
+
geodata = gpd.read_file("/content/zone_data.geojson")
|
| 25 |
+
|
| 26 |
+
# Create a Point for the given coordinates
|
| 27 |
+
location_point = Point(x[0], x[1])
|
| 28 |
+
|
| 29 |
+
# Find the zone that the location point is in
|
| 30 |
+
zone = geodata[geodata.geometry.contains(location_point)]["id"].values.item()
|
| 31 |
+
|
| 32 |
+
if selected_option in ["Off-Street Parking Facility", "Residential"]:
|
| 33 |
+
output_additional = f"Number of Units/Spaces:\n{additional_input}"
|
| 34 |
+
else:
|
| 35 |
+
output_additional = f"Area (in 1000 GSF):\n{additional_input}"
|
| 36 |
+
|
| 37 |
+
output_transport_analysis = (
|
| 38 |
+
f"Transport Analysis Needed:\n{transport_analysis_needed}"
|
| 39 |
+
)
|
| 40 |
+
|
| 41 |
+
# Replace 'Your Zone Calculation Logic' with the actual zone calculation code
|
| 42 |
+
|
| 43 |
+
output_zone = f"Zone:\n{zone}"
|
| 44 |
+
|
| 45 |
+
return (
|
| 46 |
+
output_address,
|
| 47 |
+
output_option,
|
| 48 |
+
output_additional,
|
| 49 |
+
output_transport_analysis,
|
| 50 |
+
output_zone,
|
| 51 |
+
)
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
iface = gr.Interface(
|
| 55 |
+
fn=process_input,
|
| 56 |
+
inputs=[
|
| 57 |
+
gr.inputs.Textbox(label="Enter your address"),
|
| 58 |
+
gr.inputs.Radio(
|
| 59 |
+
[
|
| 60 |
+
"Residential",
|
| 61 |
+
"Office",
|
| 62 |
+
"Regional Retail",
|
| 63 |
+
"Local Retail",
|
| 64 |
+
"Sit Down/High Turnover Restaurant",
|
| 65 |
+
"Fast Food/without Drive Through",
|
| 66 |
+
"Community Facility",
|
| 67 |
+
"Off-Street Parking Facility",
|
| 68 |
+
],
|
| 69 |
+
label="Select an option",
|
| 70 |
+
),
|
| 71 |
+
gr.inputs.Number(
|
| 72 |
+
label="Number of Units/Spaces or Area (in 1000 GSF)", default=1
|
| 73 |
+
), # Default value is 1
|
| 74 |
+
],
|
| 75 |
+
outputs=[
|
| 76 |
+
gr.outputs.Textbox(label="Address"),
|
| 77 |
+
gr.outputs.Textbox(label="Selected Option"),
|
| 78 |
+
gr.outputs.Textbox(label="Number of Units/Spaces or Area"),
|
| 79 |
+
gr.outputs.Textbox(label="Transport Analysis Needed"),
|
| 80 |
+
gr.outputs.Textbox(label="Zone"),
|
| 81 |
+
],
|
| 82 |
+
)
|
| 83 |
+
|
| 84 |
+
iface.launch()
|
zone_data.geojson
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
zone_table.csv
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Development Type,Zone 1,Zone 2,Zone 3,Zone 4,Zone 5
|
| 2 |
+
Residential,240,200,200,200,100
|
| 3 |
+
Office,115,100,100,75,40
|
| 4 |
+
Regional Retail,30,20,20,10,10
|
| 5 |
+
Local Retail,15,15,15,10,10
|
| 6 |
+
Sit Down/High Turnover Restaurant,10,10,5,5,5
|
| 7 |
+
Fast Food/without Drive Through,2.5,2.5,2.5,2,2
|
| 8 |
+
Community Facility,25,25,25,15,15
|
| 9 |
+
Off-Street Parking Facility,85,85,80,60,60
|