cyberai-1 commited on
Commit ·
3131a8e
1
Parent(s): 02c9b5f
Update tensorflow
Browse files
app.py
CHANGED
|
@@ -8,7 +8,7 @@ import urllib.request
|
|
| 8 |
import numpy as np
|
| 9 |
from flask import Flask, jsonify, render_template, request
|
| 10 |
from PIL import Image
|
| 11 |
-
|
| 12 |
import torch
|
| 13 |
import torch.nn as nn
|
| 14 |
import torch.nn.functional as F
|
|
@@ -126,11 +126,16 @@ def load_pytorch():
|
|
| 126 |
|
| 127 |
def load_tensorflow():
|
| 128 |
global _tf_model
|
| 129 |
-
if _tf_model is None:
|
| 130 |
-
|
| 131 |
-
_tf_model = tf.keras.models.load_model("parfait_model.keras")
|
| 132 |
-
return _tf_model
|
| 133 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
|
| 135 |
def read_input_image():
|
| 136 |
if "image" in request.files and request.files["image"].filename:
|
|
|
|
| 8 |
import numpy as np
|
| 9 |
from flask import Flask, jsonify, render_template, request
|
| 10 |
from PIL import Image
|
| 11 |
+
import tensorflow as tf
|
| 12 |
import torch
|
| 13 |
import torch.nn as nn
|
| 14 |
import torch.nn.functional as F
|
|
|
|
| 126 |
|
| 127 |
def load_tensorflow():
|
| 128 |
global _tf_model
|
| 129 |
+
if _tf_model is not None:
|
| 130 |
+
return _tf_model
|
|
|
|
|
|
|
| 131 |
|
| 132 |
+
import tensorflow as tf
|
| 133 |
+
|
| 134 |
+
model = build_cnn_tf(num_classes=6, input_shape=(228, 228, 3))
|
| 135 |
+
model.load_weights("parfait_model.keras")
|
| 136 |
+
_tf_model = model
|
| 137 |
+
return _tf_model
|
| 138 |
+
|
| 139 |
|
| 140 |
def read_input_image():
|
| 141 |
if "image" in request.files and request.files["image"].filename:
|