Spaces:
Runtime error
Runtime error
finished app no frills
Browse files
app.py
CHANGED
@@ -23,31 +23,31 @@ Original file is located at
|
|
23 |
"""
|
24 |
|
25 |
def train_and_inference(api_key, ontology_id, model_run_id):
|
26 |
-
st.write('thisisstarting')
|
27 |
api_key = api_key # insert Labelbox API key
|
28 |
ontology_id = ontology_id # get the ontology ID from the Settings tab at the top left of your model run
|
29 |
model_run_id = model_run_id #get the model run ID from the settings gear icon on the right side of your Model Run
|
30 |
-
st.write('1')
|
31 |
import pydantic
|
32 |
st.write(pydantic.__version__)
|
33 |
|
34 |
import numpy as np
|
35 |
-
st.write('2')
|
36 |
import tensorflow as tf
|
37 |
-
st.write('3')
|
38 |
from tensorflow.keras import layers
|
39 |
-
st.write('4')
|
40 |
from tensorflow.keras.models import Sequential
|
41 |
-
st.write('5')
|
42 |
from tensorflow.keras.preprocessing.image import ImageDataGenerator
|
43 |
-
st.write('6')
|
44 |
import os
|
45 |
-
st.write('7')
|
46 |
import labelbox
|
47 |
-
st.write('zat')
|
48 |
from labelbox import Client
|
49 |
-
st.write('8')
|
50 |
-
st.write('9')
|
51 |
import numpy as np
|
52 |
import tensorflow as tf
|
53 |
from tensorflow.keras import layers
|
@@ -80,7 +80,7 @@ def train_and_inference(api_key, ontology_id, model_run_id):
|
|
80 |
import uuid
|
81 |
import time
|
82 |
import requests
|
83 |
-
st.write('
|
84 |
|
85 |
"""Connect to labelbox client
|
86 |
Define Model Variables
|
@@ -192,14 +192,15 @@ def train_and_inference(api_key, ontology_id, model_run_id):
|
|
192 |
loss='categorical_crossentropy',
|
193 |
metrics=['accuracy'])
|
194 |
|
195 |
-
|
196 |
history = model.fit(
|
197 |
train_ds,
|
198 |
validation_data=validation_ds,
|
199 |
epochs=EPOCHS
|
200 |
)
|
201 |
|
202 |
-
"""
|
|
|
203 |
|
204 |
import numpy as np
|
205 |
import requests
|
@@ -266,15 +267,15 @@ def train_and_inference(api_key, ontology_id, model_run_id):
|
|
266 |
|
267 |
st.write(prediction_import.errors == [])
|
268 |
if prediction_import.errors == []:
|
269 |
-
return "
|
270 |
|
271 |
-
st.title("
|
272 |
api_key = st.text_input("Enter your api key:", type="password")
|
273 |
model_run_id = st.text_input("Enter your model run ID:")
|
274 |
ontology_id = st.text_input("Enter your ontology ID:")
|
275 |
|
276 |
if st.button("Train and run inference"):
|
277 |
-
st.write('
|
278 |
# Check if the key is not empty
|
279 |
if api_key + model_run_id + ontology_id:
|
280 |
result = train_and_inference(api_key, ontology_id, model_run_id)
|
|
|
23 |
"""
|
24 |
|
25 |
def train_and_inference(api_key, ontology_id, model_run_id):
|
26 |
+
# st.write('thisisstarting')
|
27 |
api_key = api_key # insert Labelbox API key
|
28 |
ontology_id = ontology_id # get the ontology ID from the Settings tab at the top left of your model run
|
29 |
model_run_id = model_run_id #get the model run ID from the settings gear icon on the right side of your Model Run
|
30 |
+
# st.write('1')
|
31 |
import pydantic
|
32 |
st.write(pydantic.__version__)
|
33 |
|
34 |
import numpy as np
|
35 |
+
# st.write('2')
|
36 |
import tensorflow as tf
|
37 |
+
# st.write('3')
|
38 |
from tensorflow.keras import layers
|
39 |
+
# st.write('4')
|
40 |
from tensorflow.keras.models import Sequential
|
41 |
+
# st.write('5')
|
42 |
from tensorflow.keras.preprocessing.image import ImageDataGenerator
|
43 |
+
# st.write('6')
|
44 |
import os
|
45 |
+
# st.write('7')
|
46 |
import labelbox
|
47 |
+
# st.write('zat')
|
48 |
from labelbox import Client
|
49 |
+
# st.write('8')
|
50 |
+
# st.write('9')
|
51 |
import numpy as np
|
52 |
import tensorflow as tf
|
53 |
from tensorflow.keras import layers
|
|
|
80 |
import uuid
|
81 |
import time
|
82 |
import requests
|
83 |
+
# st.write('imports')
|
84 |
|
85 |
"""Connect to labelbox client
|
86 |
Define Model Variables
|
|
|
192 |
loss='categorical_crossentropy',
|
193 |
metrics=['accuracy'])
|
194 |
|
195 |
+
st.write("training")
|
196 |
history = model.fit(
|
197 |
train_ds,
|
198 |
validation_data=validation_ds,
|
199 |
epochs=EPOCHS
|
200 |
)
|
201 |
|
202 |
+
"""Run Inference on Model run Datarows"""
|
203 |
+
st.write('running Inference')
|
204 |
|
205 |
import numpy as np
|
206 |
import requests
|
|
|
267 |
|
268 |
st.write(prediction_import.errors == [])
|
269 |
if prediction_import.errors == []:
|
270 |
+
return "Model Trained and inference ran successfully"
|
271 |
|
272 |
+
st.title("Enter Applicable IDs and keys below")
|
273 |
api_key = st.text_input("Enter your api key:", type="password")
|
274 |
model_run_id = st.text_input("Enter your model run ID:")
|
275 |
ontology_id = st.text_input("Enter your ontology ID:")
|
276 |
|
277 |
if st.button("Train and run inference"):
|
278 |
+
st.write('Starting Up...')
|
279 |
# Check if the key is not empty
|
280 |
if api_key + model_run_id + ontology_id:
|
281 |
result = train_and_inference(api_key, ontology_id, model_run_id)
|