Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,12 +1,10 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from gradio_folium import Folium
|
| 3 |
-
from folium import Map, Marker, PolyLine, Icon
|
| 4 |
import pandas as pd
|
| 5 |
import numpy as np
|
| 6 |
from geopy.distance import geodesic
|
| 7 |
-
import folium
|
| 8 |
|
| 9 |
-
|
| 10 |
def calculate_distances(coords):
|
| 11 |
distances = []
|
| 12 |
num_coords = len(coords)
|
|
@@ -94,8 +92,8 @@ def generate_map_with_stats(postcode_groups_input):
|
|
| 94 |
|
| 95 |
iface = gr.Interface(
|
| 96 |
fn=generate_map_with_stats,
|
| 97 |
-
inputs=
|
| 98 |
-
outputs=[
|
| 99 |
title="99 Speedmart Stores Analyzer",
|
| 100 |
description="This app allows you to <b>input <a href='https://en.wikipedia.org/wiki/Postal_codes_in_Malaysia#:~:text=Postal%20codes%20in%20Malaysia%20%2D%20Wikipedia,History'>postcode areas</a></b> and <b>visualize</b> the locations of <a href='https://www.99speedmart.com.my/About'>99 Speedmart</a> stores within those areas.\n \nYou can <b>analyze the shortest, longest, and average distances</b> between stores. \nEnter the first few digits of the postcode (up to 5 digits) and you may combine multiple postcode areas by separating them by commas.\n\n\nYou may try: \n\n 811,813 for Tebrau(811xx) and Kempas(813xx) \n\n 4 for Klang(4xxxx) \n\n 83 for Batu Pahat(83xxx)",
|
| 101 |
article="\n\n\n*Store location data was last updated in February 2024.",
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from gradio_folium import Folium
|
|
|
|
| 3 |
import pandas as pd
|
| 4 |
import numpy as np
|
| 5 |
from geopy.distance import geodesic
|
|
|
|
| 6 |
|
| 7 |
+
|
| 8 |
def calculate_distances(coords):
|
| 9 |
distances = []
|
| 10 |
num_coords = len(coords)
|
|
|
|
| 92 |
|
| 93 |
iface = gr.Interface(
|
| 94 |
fn=generate_map_with_stats,
|
| 95 |
+
inputs="text",
|
| 96 |
+
outputs=["folium", "text"],
|
| 97 |
title="99 Speedmart Stores Analyzer",
|
| 98 |
description="This app allows you to <b>input <a href='https://en.wikipedia.org/wiki/Postal_codes_in_Malaysia#:~:text=Postal%20codes%20in%20Malaysia%20%2D%20Wikipedia,History'>postcode areas</a></b> and <b>visualize</b> the locations of <a href='https://www.99speedmart.com.my/About'>99 Speedmart</a> stores within those areas.\n \nYou can <b>analyze the shortest, longest, and average distances</b> between stores. \nEnter the first few digits of the postcode (up to 5 digits) and you may combine multiple postcode areas by separating them by commas.\n\n\nYou may try: \n\n 811,813 for Tebrau(811xx) and Kempas(813xx) \n\n 4 for Klang(4xxxx) \n\n 83 for Batu Pahat(83xxx)",
|
| 99 |
article="\n\n\n*Store location data was last updated in February 2024.",
|