ezAhmed commited on
Commit
1e86112
·
verified ·
1 Parent(s): ef543b3

Upload 4 files

Browse files
Files changed (2) hide show
  1. README.md +35 -35
  2. app.py +5 -7
README.md CHANGED
@@ -1,35 +1,35 @@
1
- ---
2
- title: GERD Lightweight ViT Classifier
3
- emoji: 🏥
4
- colorFrom: blue
5
- colorTo: green
6
- sdk: gradio
7
- sdk_version: 6.2.0
8
- app_file: app.py
9
- pinned: false
10
- ---
11
-
12
- # GERD Lightweight Vision Transformer Classifier
13
-
14
- This is a lightweight Vision Transformer model for GERD classification.
15
-
16
- ## Model Architecture
17
-
18
- - **Image size**: 224×224×3
19
- - **Patch size**: 8×8
20
- - **Projection dimension**: 64
21
- - **Transformer layers**: 4
22
- - **Attention heads**: 4
23
- - **MLP head units**: [128, 64]
24
-
25
- ## Usage
26
-
27
- Upload an image and the model will classify it into one of the predefined classes.
28
-
29
- ## Preprocessing
30
-
31
- Images are:
32
-
33
- 1. Resized to 224×224
34
- 2. Converted to RGB
35
- 3. Normalized to [0, 1] range
 
1
+ ---
2
+ title: GERD Lightweight ViT Classifier
3
+ emoji: 🏥
4
+ colorFrom: blue
5
+ colorTo: green
6
+ sdk: gradio
7
+ sdk_version: 4.0.0
8
+ app_file: app.py
9
+ pinned: false
10
+ ---
11
+
12
+ # GERD Lightweight Vision Transformer Classifier
13
+
14
+ This is a lightweight Vision Transformer model for GERD classification.
15
+
16
+ ## Model Architecture
17
+
18
+ - **Image size**: 224×224×3
19
+ - **Patch size**: 8×8
20
+ - **Projection dimension**: 64
21
+ - **Transformer layers**: 4
22
+ - **Attention heads**: 4
23
+ - **MLP head units**: [128, 64]
24
+
25
+ ## Usage
26
+
27
+ Upload an image and the model will classify it into one of the predefined classes.
28
+
29
+ ## Preprocessing
30
+
31
+ Images are:
32
+
33
+ 1. Resized to 224×224
34
+ 2. Converted to RGB
35
+ 3. Normalized to [0, 1] range
app.py CHANGED
@@ -11,8 +11,8 @@ import os
11
 
12
 
13
  class Patches(L.Layer):
14
- def __init__(self, patch_size):
15
- super(Patches, self).__init__()
16
  self.patch_size = patch_size
17
 
18
  def call(self, images):
@@ -30,8 +30,8 @@ class Patches(L.Layer):
30
 
31
 
32
  class PatchEncoder(L.Layer):
33
- def __init__(self, num_patches, projection_dim):
34
- super(PatchEncoder, self).__init__()
35
  self.num_patches = num_patches
36
  self.projection = L.Dense(units=projection_dim)
37
  self.position_embedding = L.Embedding(
@@ -158,9 +158,7 @@ iface = gr.Interface(
158
  outputs=gr.Label(num_top_classes=4, label="Predictions"),
159
  title=title,
160
  description=description,
161
- examples=examples,
162
- allow_flagging="never",
163
- theme=gr.themes.Soft()
164
  )
165
 
166
  # Launch the interface
 
11
 
12
 
13
  class Patches(L.Layer):
14
+ def __init__(self, patch_size, **kwargs):
15
+ super(Patches, self).__init__(**kwargs)
16
  self.patch_size = patch_size
17
 
18
  def call(self, images):
 
30
 
31
 
32
  class PatchEncoder(L.Layer):
33
+ def __init__(self, num_patches, projection_dim, **kwargs):
34
+ super(PatchEncoder, self).__init__(**kwargs)
35
  self.num_patches = num_patches
36
  self.projection = L.Dense(units=projection_dim)
37
  self.position_embedding = L.Embedding(
 
158
  outputs=gr.Label(num_top_classes=4, label="Predictions"),
159
  title=title,
160
  description=description,
161
+ examples=examples
 
 
162
  )
163
 
164
  # Launch the interface