pfrei commited on
Commit
5ffd3c6
·
verified ·
1 Parent(s): 4149223

Upload 5 files

Browse files
.gitattributes CHANGED
@@ -33,3 +33,6 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ kia_mnist_keras_model.keras filter=lfs diff=lfs merge=lfs -text
37
+ pokemon-model_transferlearning.keras filter=lfs diff=lfs merge=lfs -text
38
+ pokemon_model_transferlearning.keras filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -1,13 +1,12 @@
1
  ---
2
- title: Ki
3
- emoji: 🌍
4
- colorFrom: gray
5
- colorTo: blue
6
  sdk: gradio
7
- sdk_version: 4.27.0
8
  app_file: app.py
9
  pinned: false
10
- license: mit
11
  ---
12
 
13
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: Mnist
3
+ emoji: 🐠
4
+ colorFrom: pink
5
+ colorTo: pink
6
  sdk: gradio
7
+ sdk_version: 4.21.0
8
  app_file: app.py
9
  pinned: false
 
10
  ---
11
 
12
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import tensorflow as tf
3
+ from PIL import Image
4
+ import numpy as np
5
+
6
+ # Load your custom regression model
7
+ model_path = "pokemon_model_transferlearning.keras"
8
+ model = tf.keras.models.load_model(model_path)
9
+
10
+ labels = ['Wartortle', 'Weedle', 'Weepinbell', 'Weezing']
11
+
12
+ # Define regression function
13
+ def predict_regression(image):
14
+ # Preprocess image
15
+ image = Image.fromarray(image.astype('uint8')) # Convert numpy array to PIL image
16
+ image = image.resize((28, 28)).convert('L') #resize the image to 28x28 and converts it to gray scale
17
+ image = np.array(image)
18
+ print(image.shape)
19
+ # Predict
20
+ prediction = model.predict(image[None, ...]) # Assuming single regression value
21
+ confidences = {labels[i]: np.round(float(prediction[0][i]), 2) for i in range(len(labels))}
22
+ return confidences
23
+
24
+ # Create Gradio interface
25
+ input_image = gr.Image()
26
+ output_text = gr.Textbox(label="Predicted Value")
27
+ interface = gr.Interface(fn=predict_regression,
28
+ inputs=input_image,
29
+ outputs=gr.Label(),
30
+ examples=["images/wartortle.jpg", "images/weedle.jpg", "images/weepinbell.jpg", "images/weezing.jpg"],
31
+ description="A simple mlp classification model for image classification using the mnist dataset.")
32
+ interface.launch()
pokemon_model_transferlearning.keras ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3ee93d0b0843ac45aa439ce6b9f1a0180459cf7a4bef952519624eeca74e60e5
3
+ size 250584688
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ tensorflow