Spaces:
Sleeping
Sleeping
Got "TF-TRT Warning: Could not find TensorRT" error any tried with "tf.config.experimental._could_use_gpu_kernel = False"
Browse files
app.py
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
# from transformers import TFAutoModel
|
| 3 |
-
import torch
|
| 4 |
from torchvision import transforms
|
| 5 |
import tensorflow as tf
|
| 6 |
|
|
|
|
|
|
|
| 7 |
model_path = "./4-15_ViT-B16_Lung3_v1"
|
| 8 |
# model = tf.keras.models.load_model(model_path)
|
| 9 |
model = tf.keras.layers.TFSMLayer(model_path, call_endpoint='serving_default')
|
|
@@ -24,12 +24,6 @@ def predict(image):
|
|
| 24 |
# Preprocess the image
|
| 25 |
preprocessed_image = preprocess_image(image)
|
| 26 |
|
| 27 |
-
# # Convert preprocessed image to input format expected by the model
|
| 28 |
-
# inputs = tokenizer(preprocessed_image, return_tensors="tf")
|
| 29 |
-
|
| 30 |
-
# Perform model inference
|
| 31 |
-
# outputs = model(**inputs)
|
| 32 |
-
|
| 33 |
# Add batch dimension to input image
|
| 34 |
input_tensor = tf.expand_dims(preprocessed_image, axis=0)
|
| 35 |
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
| 2 |
from torchvision import transforms
|
| 3 |
import tensorflow as tf
|
| 4 |
|
| 5 |
+
tf.config.experimental._could_use_gpu_kernel = False
|
| 6 |
+
|
| 7 |
model_path = "./4-15_ViT-B16_Lung3_v1"
|
| 8 |
# model = tf.keras.models.load_model(model_path)
|
| 9 |
model = tf.keras.layers.TFSMLayer(model_path, call_endpoint='serving_default')
|
|
|
|
| 24 |
# Preprocess the image
|
| 25 |
preprocessed_image = preprocess_image(image)
|
| 26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
# Add batch dimension to input image
|
| 28 |
input_tensor = tf.expand_dims(preprocessed_image, axis=0)
|
| 29 |
|