Spaces:
Runtime error
Runtime error
gowthambhat
commited on
Commit
•
1693af9
1
Parent(s):
8907d5b
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,8 @@
|
|
1 |
import tensorflow as tf
|
2 |
from tensorflow import keras
|
3 |
from tensorflow.keras import layers
|
|
|
|
|
4 |
import numpy as np
|
5 |
import gradio as gr
|
6 |
|
@@ -8,9 +10,11 @@ max_length = 5
|
|
8 |
img_width = 200
|
9 |
img_height = 50
|
10 |
|
|
|
|
|
|
|
11 |
# Load the TensorFlow SavedModel using TFSMLayer
|
12 |
-
|
13 |
-
prediction_layer = keras.layers.TFSMLayer(saved_model_path, call_endpoint='serving_default')
|
14 |
|
15 |
with open("vocab.txt", "r") as f:
|
16 |
vocab = f.read().splitlines()
|
@@ -60,4 +64,3 @@ iface = gr.Interface(classify_image, image, text,
|
|
60 |
)
|
61 |
|
62 |
iface.launch()
|
63 |
-
|
|
|
1 |
import tensorflow as tf
|
2 |
from tensorflow import keras
|
3 |
from tensorflow.keras import layers
|
4 |
+
from huggingface_hub import snapshot_download
|
5 |
+
|
6 |
import numpy as np
|
7 |
import gradio as gr
|
8 |
|
|
|
10 |
img_width = 200
|
11 |
img_height = 50
|
12 |
|
13 |
+
# Download the model from Hugging Face
|
14 |
+
model_path = snapshot_download(repo_id="keras-io/ocr-for-captcha")
|
15 |
+
|
16 |
# Load the TensorFlow SavedModel using TFSMLayer
|
17 |
+
prediction_layer = keras.layers.TFSMLayer(model_path, call_endpoint='serving_default')
|
|
|
18 |
|
19 |
with open("vocab.txt", "r") as f:
|
20 |
vocab = f.read().splitlines()
|
|
|
64 |
)
|
65 |
|
66 |
iface.launch()
|
|