ebanek Claude Fable 5 commited on
Commit
5e5b00f
·
1 Parent(s): eb80a87

Prep for Hugging Face Spaces: add img.jpg + requirements.txt, drop share=True, use tempfile for CSV export

Browse files
Files changed (4) hide show
  1. README.md +1 -0
  2. app.py +6 -4
  3. img.jpg +0 -0
  4. requirements.txt +4 -0
README.md CHANGED
@@ -4,6 +4,7 @@ python_version: "3.11"
4
  app_file: app.py
5
  pinned: false
6
  sdk: gradio
 
7
  ---
8
 
9
  # App for getting points from a geographic map - lots of manual clicking
 
4
  app_file: app.py
5
  pinned: false
6
  sdk: gradio
7
+ sdk_version: "6.9.0"
8
  ---
9
 
10
  # App for getting points from a geographic map - lots of manual clicking
app.py CHANGED
@@ -14,6 +14,7 @@ Run with:
14
 
15
  import csv
16
  import io
 
17
 
18
  import gradio as gr
19
  from PIL import Image
@@ -293,10 +294,11 @@ def build_app():
293
  w.writerow(["Label", "Latitude_N", "Longitude_E", "Pixel_X", "Pixel_Y"])
294
  for p in picked:
295
  w.writerow([p.get("label", ""), p["lat"], p["lon"], p["px"], p["py"]])
296
- tmp = "/tmp/georect_points.csv"
297
- with open(tmp, "w") as f:
 
298
  f.write(buf.getvalue())
299
- return gr.update(value=tmp, visible=True)
300
 
301
  exp_btn.click(on_export, picked_st, csv_out)
302
 
@@ -304,4 +306,4 @@ def build_app():
304
 
305
 
306
  if __name__ == "__main__":
307
- build_app().launch(share=True, theme=gr.themes.Soft(), js=ZOOM_JS)
 
14
 
15
  import csv
16
  import io
17
+ import tempfile
18
 
19
  import gradio as gr
20
  from PIL import Image
 
294
  w.writerow(["Label", "Latitude_N", "Longitude_E", "Pixel_X", "Pixel_Y"])
295
  for p in picked:
296
  w.writerow([p.get("label", ""), p["lat"], p["lon"], p["px"], p["py"]])
297
+ with tempfile.NamedTemporaryFile(
298
+ mode="w", suffix=".csv", prefix="georect_points_", delete=False
299
+ ) as f:
300
  f.write(buf.getvalue())
301
+ return gr.update(value=f.name, visible=True)
302
 
303
  exp_btn.click(on_export, picked_st, csv_out)
304
 
 
306
 
307
 
308
  if __name__ == "__main__":
309
+ build_app().launch(theme=gr.themes.Soft(), js=ZOOM_JS)
img.jpg ADDED
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ numpy>=2.4.3
2
+ pandas>=3.0.1
3
+ pillow>=12.1.1
4
+ pyproj>=3.7.2