To use this model, you can either interact with it programmatically using the Python code below or through a web-based interface provided by Gradio.
1from transformers import TFAutoModelForImageClassification, AutoTokenizer
2import gradio as gr
3
4# Laden Sie das Modell und den Tokenizer von Hugging Face herunter
5model = TFAutoModelForImageClassification.from_pretrained("kiki7555/pokemon_classifier_tf")
6tokenizer = AutoTokenizer.from_pretrained("kiki7555/pokemon_classifier_tf")
7
8def predict_pokemon(image):
9 # Hier kannst du die Bildvorverarbeitung und -nachverarbeitung hinzufügen
10 # ...
11
12 # Vorhersage treffen
13 predictions = model.predict(image) # Hier musst du die genaue Vorverarbeitung für das Bild hinzufügen
14 predicted_class = predictions.argmax()
15
16 class_names = ['Charizard', 'Pikachu', 'Zapdos']
17 return class_names[predicted_class]
18
19# Gradio UI erstellen
20image_input = gr.inputs.Image(shape=(128, 128))
21output_text = gr.outputs.Textbox()
22
23gr.Interface(
24 fn=predict_pokemon,
25 inputs=image_input,
26 outputs=output_text,
27 title="Pokemon Classifier",
28 description="Classify images of Pokemon into three categories: Charizard, Pikachu, and Zapdos."
29).launch()