Spaces:
Runtime error
Runtime error
Download app.py from vickyG/Facial_Recognition_Live_Camera: direct link, hf CLI and curl.
- Browser
- Download file 589 Bytes
-
https://huggingface.co/spaces/vickyG/Facial_Recognition_Live_Camera/resolve/main/app.py
- Command line
-
hf download hf://spaces/vickyG/Facial_Recognition_Live_Camera/app.py
-
curl -L -o app.py https://huggingface.co/spaces/vickyG/Facial_Recognition_Live_Camera/resolve/main/app.py
589 Bytes
| import gradio as gr | |
| import tensorflow as tf | |
| from keras.models import model_from_json | |
| model = tf.keras.models.load_model('model') | |
| image_size = 250 | |
| def predict_image(img): | |
| img_4d=img.reshape(-1,image_size,image_size,3) | |
| prediction=model.predict(img_4d, verbose=0)[0] | |
| print(prediction) | |
| return {"Victoria": float(prediction[i]) for i in range(1)} | |
| image = gr.inputs.Image(source="webcam", shape=(image_size,image_size)) | |
| label = gr.outputs.Label(num_top_classes=1) | |
| gr.Interface(fn=predict_image, inputs=image, outputs=label,interpretation='default').launch(debug='True') |