Spaces:
Sleeping
Sleeping
Commit
·
c599c36
1
Parent(s):
46beb4a
Rename Deeploy Model Token to Deeploy API token
Browse files- app.py +94 -18
- requirements.txt +1 -1
app.py
CHANGED
@@ -57,7 +57,7 @@ def predict_callback():
|
|
57 |
print("Request body: ", request_body)
|
58 |
# Call the explain endpoint as it also includes the prediction
|
59 |
pred = client.predict(
|
60 |
-
request_body=request_body, deployment_id=deployment_id
|
61 |
)
|
62 |
except Exception as e:
|
63 |
logging.error(e)
|
@@ -110,7 +110,7 @@ with st.sidebar:
|
|
110 |
# Ask for model URL and token
|
111 |
host = st.text_input("Host (Changing is optional)", "app.deeploy.ml")
|
112 |
model_url, workspace_id, deployment_id = get_model_url()
|
113 |
-
deployment_token = st.text_input("Deeploy
|
114 |
if deployment_token == "my-secret-token":
|
115 |
st.warning("Please enter Deeploy API token.")
|
116 |
|
@@ -131,26 +131,102 @@ with st.sidebar:
|
|
131 |
# st.write(st.session_state)
|
132 |
|
133 |
# Input (for IRIS dataset)
|
134 |
-
with st.expander("Input values for prediction", expanded=True):
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
|
144 |
request_body = {
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
]
|
|
|
153 |
}
|
|
|
154 |
|
155 |
# Predict and explain
|
156 |
predict_button = st.button("Predict", on_click=predict_callback)
|
|
|
57 |
print("Request body: ", request_body)
|
58 |
# Call the explain endpoint as it also includes the prediction
|
59 |
pred = client.predict(
|
60 |
+
request_body=st.session_state.request_body, deployment_id=deployment_id
|
61 |
)
|
62 |
except Exception as e:
|
63 |
logging.error(e)
|
|
|
110 |
# Ask for model URL and token
|
111 |
host = st.text_input("Host (Changing is optional)", "app.deeploy.ml")
|
112 |
model_url, workspace_id, deployment_id = get_model_url()
|
113 |
+
deployment_token = st.text_input("Deeploy API token", "my-secret-token")
|
114 |
if deployment_token == "my-secret-token":
|
115 |
st.warning("Please enter Deeploy API token.")
|
116 |
|
|
|
131 |
# st.write(st.session_state)
|
132 |
|
133 |
# Input (for IRIS dataset)
|
134 |
+
# with st.expander("Input values for prediction", expanded=True):
|
135 |
+
# st.write("Please input the values for the model.")
|
136 |
+
# col1, col2 = st.columns(2)
|
137 |
+
# with col1:
|
138 |
+
# sep_len = st.number_input("Sepal length", value=1.0, step=0.1, key="Sepal length")
|
139 |
+
# sep_wid = st.number_input("Sepal width", value=1.0, step=0.1, key="Sepal width")
|
140 |
+
# with col2:
|
141 |
+
# pet_len = st.number_input("Petal length", value=1.0, step=0.1, key="Petal length")
|
142 |
+
# pet_wid = st.number_input("Petal width", value=1.0, step=0.1, key="Petal width")
|
143 |
|
144 |
request_body = {
|
145 |
+
"instances": [
|
146 |
+
[
|
147 |
+
20,
|
148 |
+
"RH",
|
149 |
+
80,
|
150 |
+
11622,
|
151 |
+
"Pave",
|
152 |
+
"missing",
|
153 |
+
"Reg",
|
154 |
+
"Lvl",
|
155 |
+
"AllPub",
|
156 |
+
"Inside",
|
157 |
+
"Gtl",
|
158 |
+
"NAmes",
|
159 |
+
"Feedr",
|
160 |
+
"Norm",
|
161 |
+
"1Fam",
|
162 |
+
"1Story",
|
163 |
+
5,
|
164 |
+
6,
|
165 |
+
1961,
|
166 |
+
1961,
|
167 |
+
"Gable",
|
168 |
+
"CompShg",
|
169 |
+
"VinylSd",
|
170 |
+
"VinylSd",
|
171 |
+
"NA",
|
172 |
+
0,
|
173 |
+
"TA",
|
174 |
+
"TA",
|
175 |
+
"CBlock",
|
176 |
+
"TA",
|
177 |
+
"TA",
|
178 |
+
"No",
|
179 |
+
"Rec",
|
180 |
+
468,
|
181 |
+
"LwQ",
|
182 |
+
144,
|
183 |
+
270,
|
184 |
+
882,
|
185 |
+
"GasA",
|
186 |
+
"TA",
|
187 |
+
"Y",
|
188 |
+
"SBrkr",
|
189 |
+
896,
|
190 |
+
0,
|
191 |
+
0,
|
192 |
+
896,
|
193 |
+
0,
|
194 |
+
0,
|
195 |
+
1,
|
196 |
+
0,
|
197 |
+
2,
|
198 |
+
1,
|
199 |
+
"TA",
|
200 |
+
5,
|
201 |
+
"Typ",
|
202 |
+
0,
|
203 |
+
"missing",
|
204 |
+
"Attchd",
|
205 |
+
1961,
|
206 |
+
"Unf",
|
207 |
+
1,
|
208 |
+
730,
|
209 |
+
"TA",
|
210 |
+
"TA",
|
211 |
+
"Y",
|
212 |
+
140,
|
213 |
+
0,
|
214 |
+
0,
|
215 |
+
0,
|
216 |
+
120,
|
217 |
+
0,
|
218 |
+
"missing",
|
219 |
+
"MnPrv",
|
220 |
+
"missing",
|
221 |
+
0,
|
222 |
+
6,
|
223 |
+
2010,
|
224 |
+
"WD",
|
225 |
+
"Normal"
|
226 |
]
|
227 |
+
]
|
228 |
}
|
229 |
+
st.session_state.request_body = request_body
|
230 |
|
231 |
# Predict and explain
|
232 |
predict_button = st.button("Predict", on_click=predict_callback)
|
requirements.txt
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
deeploy==1.
|
2 |
streamlit==1.29.0
|
3 |
plotly==5.18.0
|
|
|
1 |
+
deeploy==1.37.4
|
2 |
streamlit==1.29.0
|
3 |
plotly==5.18.0
|