manual repo input
Browse files
app.py
CHANGED
|
@@ -34,8 +34,8 @@ def get_static_map_image(lat_lon, api):
|
|
| 34 |
|
| 35 |
|
| 36 |
@st.cache_resource(show_spinner=False)
|
| 37 |
-
def load_model():
|
| 38 |
-
model_path = hf_hub_download(repo_id=
|
| 39 |
model = YOLO(model_path, task="obb")
|
| 40 |
return model
|
| 41 |
|
|
@@ -56,6 +56,11 @@ else:
|
|
| 56 |
state.GMS_KEY = api_key
|
| 57 |
st.rerun()
|
| 58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
#### Get Latitude, Longitude
|
| 60 |
lat_lon = st.text_input("Enter Latitude, Longitude (comma separated)", placeholder="28.00,77.00")
|
| 61 |
if lat_lon == "":
|
|
@@ -86,7 +91,7 @@ buffer.seek(0)
|
|
| 86 |
st.image(image, caption=lat_lon, use_column_width=True)
|
| 87 |
|
| 88 |
### Predict
|
| 89 |
-
model = load_model()
|
| 90 |
result = model(image)[0]
|
| 91 |
detections = sv.Detections.from_ultralytics(result)
|
| 92 |
|
|
|
|
| 34 |
|
| 35 |
|
| 36 |
@st.cache_resource(show_spinner=False)
|
| 37 |
+
def load_model(repo_id, filename):
|
| 38 |
+
model_path = hf_hub_download(repo_id=repo_id, filename=filename)
|
| 39 |
model = YOLO(model_path, task="obb")
|
| 40 |
return model
|
| 41 |
|
|
|
|
| 56 |
state.GMS_KEY = api_key
|
| 57 |
st.rerun()
|
| 58 |
|
| 59 |
+
# get two columns
|
| 60 |
+
col1, col2 = st.columns(2)
|
| 61 |
+
repo = col1.text_input("HF Repo", "Vannsh/v8x-obb")
|
| 62 |
+
path = col2.text_input("Model Path", "obb3.pt")
|
| 63 |
+
|
| 64 |
#### Get Latitude, Longitude
|
| 65 |
lat_lon = st.text_input("Enter Latitude, Longitude (comma separated)", placeholder="28.00,77.00")
|
| 66 |
if lat_lon == "":
|
|
|
|
| 91 |
st.image(image, caption=lat_lon, use_column_width=True)
|
| 92 |
|
| 93 |
### Predict
|
| 94 |
+
model = load_model(repo, path)
|
| 95 |
result = model(image)[0]
|
| 96 |
detections = sv.Detections.from_ultralytics(result)
|
| 97 |
|