Ajay Singh Rathore commited on
Commit
7b47217
·
1 Parent(s): c0262e8

feat: Update backend to use custom-trained model

Browse files
__pycache__/app.cpython-312.pyc ADDED
Binary file (3.74 kB). View file
 
generate_config.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import AutoImageProcessor
2
+
3
+ # The model you used as a base for fine-tuning
4
+ BASE_MODEL = "Mullerjo/food-101-finetuned-model"
5
+
6
+ # A local directory where the config file will be saved
7
+ SAVE_DIRECTORY = "my-indian-food-model-processor"
8
+
9
+ print(f"Loading the image processor from '{BASE_MODEL}'...")
10
+
11
+ # Load the processor associated with the base model
12
+ processor = AutoImageProcessor.from_pretrained(BASE_MODEL)
13
+
14
+ print(f"Saving the processor's configuration to the '{SAVE_DIRECTORY}' folder...")
15
+
16
+ # This creates the 'preprocessor_config.json' file inside the save directory
17
+ processor.save_pretrained(SAVE_DIRECTORY)
18
+
19
+ print("\nSuccess!")
20
+ print(f"The 'preprocessor_config.json' file has been created in the '{SAVE_DIRECTORY}' folder.")
my-indian-food-model-processor/preprocessor_config.json ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "do_convert_rgb": null,
3
+ "do_normalize": true,
4
+ "do_rescale": true,
5
+ "do_resize": true,
6
+ "image_mean": [
7
+ 0.5,
8
+ 0.5,
9
+ 0.5
10
+ ],
11
+ "image_processor_type": "ViTImageProcessor",
12
+ "image_std": [
13
+ 0.5,
14
+ 0.5,
15
+ 0.5
16
+ ],
17
+ "resample": 2,
18
+ "rescale_factor": 0.00392156862745098,
19
+ "size": {
20
+ "height": 224,
21
+ "width": 224
22
+ }
23
+ }