Spaces:
Running
Running
fcakyon
commited on
Commit
·
86f659b
1
Parent(s):
161c582
read initial comparison iamges from cache
Browse files
app.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
import streamlit as st
|
|
|
|
| 2 |
import sahi.utils.mmdet
|
| 3 |
import sahi.model
|
| 4 |
from PIL import Image
|
|
@@ -19,7 +20,19 @@ IMAGE_TO_URL = {
|
|
| 19 |
|
| 20 |
|
| 21 |
@st.cache(allow_output_mutation=True, show_spinner=False)
|
| 22 |
-
def
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
model_path = "yolox.pt"
|
| 24 |
sahi.utils.file.download_from_url(
|
| 25 |
MMDET_YOLOX_MODEL_URL,
|
|
@@ -73,18 +86,16 @@ st.set_page_config(
|
|
| 73 |
initial_sidebar_state="auto",
|
| 74 |
)
|
| 75 |
|
|
|
|
|
|
|
| 76 |
if "last_spinner_texts" not in st.session_state:
|
| 77 |
st.session_state["last_spinner_texts"] = SpinnerTexts()
|
| 78 |
|
| 79 |
if "output_1" not in st.session_state:
|
| 80 |
-
st.session_state["output_1"] =
|
| 81 |
-
IMAGE_TO_URL["highway2-yolox.jpg"]
|
| 82 |
-
)
|
| 83 |
|
| 84 |
if "output_2" not in st.session_state:
|
| 85 |
-
st.session_state["output_2"] = sahi.
|
| 86 |
-
IMAGE_TO_URL["highway2-sahi.jpg"]
|
| 87 |
-
)
|
| 88 |
|
| 89 |
st.markdown(
|
| 90 |
"""
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
import sahi.utils.file
|
| 3 |
import sahi.utils.mmdet
|
| 4 |
import sahi.model
|
| 5 |
from PIL import Image
|
|
|
|
| 20 |
|
| 21 |
|
| 22 |
@st.cache(allow_output_mutation=True, show_spinner=False)
|
| 23 |
+
def download_comparison_images():
|
| 24 |
+
sahi.utils.file.download_from_url(
|
| 25 |
+
"https://user-images.githubusercontent.com/34196005/143309873-c0c1f31c-c42e-4a36-834e-da0a2336bb19.jpg",
|
| 26 |
+
"highway2-yolox.jpg",
|
| 27 |
+
)
|
| 28 |
+
sahi.utils.file.download_from_url(
|
| 29 |
+
"https://user-images.githubusercontent.com/34196005/143309867-42841f5a-9181-4d22-b570-65f90f2da231.jpg",
|
| 30 |
+
"highway2-sahi.jpg",
|
| 31 |
+
)
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
@st.cache(allow_output_mutation=True, show_spinner=False)
|
| 35 |
+
def get_model():
|
| 36 |
model_path = "yolox.pt"
|
| 37 |
sahi.utils.file.download_from_url(
|
| 38 |
MMDET_YOLOX_MODEL_URL,
|
|
|
|
| 86 |
initial_sidebar_state="auto",
|
| 87 |
)
|
| 88 |
|
| 89 |
+
download_comparison_images()
|
| 90 |
+
|
| 91 |
if "last_spinner_texts" not in st.session_state:
|
| 92 |
st.session_state["last_spinner_texts"] = SpinnerTexts()
|
| 93 |
|
| 94 |
if "output_1" not in st.session_state:
|
| 95 |
+
st.session_state["output_1"] = Image.open("highway2-yolox.jpg")
|
|
|
|
|
|
|
| 96 |
|
| 97 |
if "output_2" not in st.session_state:
|
| 98 |
+
st.session_state["output_2"] = Image.open("highway2-sahi.jpg")
|
|
|
|
|
|
|
| 99 |
|
| 100 |
st.markdown(
|
| 101 |
"""
|