deepfakedetect / README.md
vaniv's picture
Update README.md
3597267 verified

A newer version of the Gradio SDK is available: 6.1.0

Upgrade
metadata
title: Keras Image Classifier
emoji: 🖼️
colorFrom: indigo
colorTo: blue
sdk: gradio
sdk_version: 5.49.1
app_file: app.py
pinned: false

Image Classifier — Keras/TensorFlow (Hugging Face Space)

A dead-simple image classification app you can deploy in minutes.

How it works

  • If model.h5 exists in the repository root, the app loads your custom Keras model.
    • Optionally add labels.txt (one class name per line) to show readable labels.
    • Input is resized to 224×224. Adjust TARGET_SIZE in app.py if your model expects a different size.
  • If no model.h5 is found, it falls back to MobileNetV2 (ImageNet).

Run locally

pip install -r requirements.txt
python app.py

Then open the local URL printed by Gradio.

Deploy to Hugging Face Spaces

  1. Create a new SpaceGradio (Python).
  2. Upload these files: app.py, requirements.txt, README.md.
  3. (Optional) Upload your model.h5 and labels.txt to use your own model.
  4. The Space will build and auto-start.

Using your notebook's model

If your notebook trained a model, export it:

model.save("model.h5")
# Optional labels file (one per line)
with open("labels.txt", "w") as f:
    f.write("\n".join(class_names))

Commit both files to the Space.