food-api / generate_config.py
Ajay Singh Rathore
feat: Update backend to use custom-trained model
7b47217
raw
history blame contribute delete
743 Bytes
from transformers import AutoImageProcessor
# The model you used as a base for fine-tuning
BASE_MODEL = "Mullerjo/food-101-finetuned-model"
# A local directory where the config file will be saved
SAVE_DIRECTORY = "my-indian-food-model-processor"
print(f"Loading the image processor from '{BASE_MODEL}'...")
# Load the processor associated with the base model
processor = AutoImageProcessor.from_pretrained(BASE_MODEL)
print(f"Saving the processor's configuration to the '{SAVE_DIRECTORY}' folder...")
# This creates the 'preprocessor_config.json' file inside the save directory
processor.save_pretrained(SAVE_DIRECTORY)
print("\nSuccess!")
print(f"The 'preprocessor_config.json' file has been created in the '{SAVE_DIRECTORY}' folder.")