Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -9,12 +9,8 @@ from huggingface_hub import HfFileSystem
|
|
9 |
from flax.serialization import msgpack_restore, from_state_dict
|
10 |
import os
|
11 |
|
12 |
-
|
13 |
hf_key = text_input = st.text_input("Access token")
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
class CNN(nn.Module):
|
19 |
"""A simple CNN model."""
|
20 |
|
@@ -35,28 +31,10 @@ class CNN(nn.Module):
|
|
35 |
cnn = CNN()
|
36 |
params = cnn.init(jax.random.PRNGKey(0), jnp.ones([1, 28, 28, 1]))['params']
|
37 |
|
38 |
-
|
39 |
fs = HfFileSystem(token=hf_key)
|
40 |
with fs.open("PrakhAI/HelloWorld/checkpoint.msgpack", "rb") as f:
|
41 |
params = from_state_dict(params, msgpack_restore(f.read())["params"])
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
# print(type(state))
|
46 |
-
# print(state)
|
47 |
-
# print([(k, type(v)) for (k, v) in state.items()])
|
48 |
-
# print(state['params'])
|
49 |
-
# print(state['opt_state'])
|
50 |
-
|
51 |
-
# logits = state.apply_fn({'params': state.params}, batch['image'])
|
52 |
-
# print(logits)
|
53 |
-
|
54 |
-
# x = st.slider('Select a value')
|
55 |
-
# st.write(x, 'squared is', x * x)
|
56 |
-
|
57 |
-
# print(dir(cnn))
|
58 |
-
|
59 |
-
|
60 |
uploaded_files = st.file_uploader("Input Images of handwritten digit (example in files)", type=['jpg','png','tif'], accept_multiple_files=True)
|
61 |
|
62 |
if len(uploaded_files) == 0:
|
|
|
9 |
from flax.serialization import msgpack_restore, from_state_dict
|
10 |
import os
|
11 |
|
|
|
12 |
hf_key = text_input = st.text_input("Access token")
|
13 |
|
|
|
|
|
|
|
14 |
class CNN(nn.Module):
|
15 |
"""A simple CNN model."""
|
16 |
|
|
|
31 |
cnn = CNN()
|
32 |
params = cnn.init(jax.random.PRNGKey(0), jnp.ones([1, 28, 28, 1]))['params']
|
33 |
|
|
|
34 |
fs = HfFileSystem(token=hf_key)
|
35 |
with fs.open("PrakhAI/HelloWorld/checkpoint.msgpack", "rb") as f:
|
36 |
params = from_state_dict(params, msgpack_restore(f.read())["params"])
|
37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
uploaded_files = st.file_uploader("Input Images of handwritten digit (example in files)", type=['jpg','png','tif'], accept_multiple_files=True)
|
39 |
|
40 |
if len(uploaded_files) == 0:
|