David-Chew-HL commited on
Commit
f851466
1 Parent(s): dbe85fd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -5
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
- # Calculate distances between all pairs of coordinates
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=gr.inputs.Textbox(label="Enter postcode groups", placeholder="E.g. '83,84' for Batu Pahat and Muar"),
98
- outputs=[Folium(), "text"],
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.",