Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,7 +8,7 @@ import torch.nn as nn
|
|
| 8 |
|
| 9 |
EXPORT_DIR = "."
|
| 10 |
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
|
| 11 |
-
TOP_K =
|
| 12 |
|
| 13 |
# ---------------- Load metadata ----------------
|
| 14 |
metadata = json.load(open(os.path.join(EXPORT_DIR, "metadata.json")))
|
|
@@ -124,11 +124,21 @@ def predict_geohash_map(img: Image.Image, true_lat=None, true_lon=None):
|
|
| 124 |
|
| 125 |
# ---------------- Gradio UI ----------------
|
| 126 |
with gr.Blocks() as demo:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 127 |
with gr.Row():
|
| 128 |
img_in = gr.Image(type="pil", label="Upload Streetview Image")
|
| 129 |
with gr.Column():
|
| 130 |
-
lat_in = gr.Number(label="True Latitude (optional)")
|
| 131 |
-
lon_in = gr.Number(label="True Longitude (optional)")
|
| 132 |
out_text = gr.Textbox(label="Predictions + Distances")
|
| 133 |
out_plot = gr.Plot(label="Map")
|
| 134 |
|
|
|
|
| 8 |
|
| 9 |
EXPORT_DIR = "."
|
| 10 |
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
|
| 11 |
+
TOP_K = 5
|
| 12 |
|
| 13 |
# ---------------- Load metadata ----------------
|
| 14 |
metadata = json.load(open(os.path.join(EXPORT_DIR, "metadata.json")))
|
|
|
|
| 124 |
|
| 125 |
# ---------------- Gradio UI ----------------
|
| 126 |
with gr.Blocks() as demo:
|
| 127 |
+
gr.Markdown(
|
| 128 |
+
"""
|
| 129 |
+
# 🌍 Locus - GeoGuessr Image to Coordinates Model
|
| 130 |
+
Upload a **streetview-style image** (photo or screenshot).
|
| 131 |
+
The model can handle images with a small UI overlay (like from Google Street View),
|
| 132 |
+
as long as the **main scene is clearly visible**.
|
| 133 |
+
|
| 134 |
+
Optionally, provide the real coordinates to compare predictions.
|
| 135 |
+
"""
|
| 136 |
+
)
|
| 137 |
with gr.Row():
|
| 138 |
img_in = gr.Image(type="pil", label="Upload Streetview Image")
|
| 139 |
with gr.Column():
|
| 140 |
+
lat_in = gr.Number(label="True Latitude (optional)", info="Enter the known latitude if available.")
|
| 141 |
+
lon_in = gr.Number(label="True Longitude (optional)", info="Enter the known longitude if available.")
|
| 142 |
out_text = gr.Textbox(label="Predictions + Distances")
|
| 143 |
out_plot = gr.Plot(label="Map")
|
| 144 |
|