Minbz commited on
Commit
f1bfe09
·
verified ·
1 Parent(s): 8b21c2f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -1,12 +1,11 @@
1
  import os
2
-
3
  os.system('pip install tf_keras')
4
 
5
- import gradio as gr
6
  from torchvision import transforms
 
7
  import tensorflow as tf
8
  import tensorflow_hub as hub
9
-
10
  import tf_keras
11
  from tf_keras.layers import Input, Dense, Dropout, GlobalAveragePooling2D
12
  from tf_keras.models import Model, Sequential
@@ -21,6 +20,8 @@ from tf_keras.applications.vgg16 import preprocess_input
21
  # from tensorflow.keras.applications.vgg16 import preprocess_input
22
  from transformers import TFAutoModelForSequenceClassification
23
 
 
 
24
  model_pb_path = "./4-15_ViT-B16_Lung3_v1/"
25
  model_keras_path = "./model.keras"
26
  model_h5_path = "./model.h5"
@@ -73,6 +74,7 @@ def preprocess_image(image):
73
  ])
74
 
75
  preprocessed_img = transform_test(image)
 
76
  return preprocessed_img
77
 
78
  # Define inference function
 
1
  import os
 
2
  os.system('pip install tf_keras')
3
 
4
+ import torch
5
  from torchvision import transforms
6
+
7
  import tensorflow as tf
8
  import tensorflow_hub as hub
 
9
  import tf_keras
10
  from tf_keras.layers import Input, Dense, Dropout, GlobalAveragePooling2D
11
  from tf_keras.models import Model, Sequential
 
20
  # from tensorflow.keras.applications.vgg16 import preprocess_input
21
  from transformers import TFAutoModelForSequenceClassification
22
 
23
+ import gradio as gr
24
+
25
  model_pb_path = "./4-15_ViT-B16_Lung3_v1/"
26
  model_keras_path = "./model.keras"
27
  model_h5_path = "./model.h5"
 
74
  ])
75
 
76
  preprocessed_img = transform_test(image)
77
+ preprocessed_img = torch.transpose(preprocessed_img, 0, 2)
78
  return preprocessed_img
79
 
80
  # Define inference function