Spaces:
Runtime error
Runtime error
Ivan Shelonik
commited on
Commit
·
ce989ee
1
Parent(s):
a7f0ae3
fix: local runs
Browse files- api_server.py +4 -5
api_server.py
CHANGED
@@ -9,16 +9,15 @@ os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
|
|
9 |
from tensorflow import keras
|
10 |
from flask import Flask, jsonify, request
|
11 |
|
12 |
-
LOCAL =
|
13 |
|
14 |
# Load the saved model into memory
|
15 |
if LOCAL is True:
|
|
|
|
|
16 |
REPO_ID = "1vash/mnist-model"
|
17 |
FILENAME = "mnist_model.h5"
|
18 |
model = keras.models.load_model(hf_hub_download(repo_id=REPO_ID, filename=FILENAME))
|
19 |
-
else:
|
20 |
-
model = keras.models.load_model('artifacts/models/mnist_model.h5')
|
21 |
-
|
22 |
|
23 |
# Initialize the Flask application
|
24 |
app = Flask(__name__)
|
@@ -117,4 +116,4 @@ if __name__ == '__main__':
|
|
117 |
# 2. You can use Chain calls of OpenAI API
|
118 |
# 3. Using your own ML model in combination with openAPI functionality
|
119 |
# 4. ...
|
120 |
-
##################
|
|
|
9 |
from tensorflow import keras
|
10 |
from flask import Flask, jsonify, request
|
11 |
|
12 |
+
LOCAL = True
|
13 |
|
14 |
# Load the saved model into memory
|
15 |
if LOCAL is True:
|
16 |
+
model = keras.models.load_model('artifacts/models/mnist_model.h5')
|
17 |
+
else:
|
18 |
REPO_ID = "1vash/mnist-model"
|
19 |
FILENAME = "mnist_model.h5"
|
20 |
model = keras.models.load_model(hf_hub_download(repo_id=REPO_ID, filename=FILENAME))
|
|
|
|
|
|
|
21 |
|
22 |
# Initialize the Flask application
|
23 |
app = Flask(__name__)
|
|
|
116 |
# 2. You can use Chain calls of OpenAI API
|
117 |
# 3. Using your own ML model in combination with openAPI functionality
|
118 |
# 4. ...
|
119 |
+
##################
|