Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,7 +9,7 @@ import torch
|
|
| 9 |
import os
|
| 10 |
import gradio as gr
|
| 11 |
|
| 12 |
-
with open("
|
| 13 |
class_names = [line.strip() for line in file]
|
| 14 |
|
| 15 |
|
|
@@ -18,7 +18,7 @@ model, transforms = vit_b_16(num_classes=101,
|
|
| 18 |
freeze_gradients=True,
|
| 19 |
unfreeze_blocks=0)
|
| 20 |
|
| 21 |
-
model.load_state_dict(torch.load('
|
| 22 |
weights_only=True))
|
| 23 |
|
| 24 |
|
|
@@ -55,7 +55,7 @@ and fine-tuning the results for specific food categories.
|
|
| 55 |
This model achieved a Top-1 accuracy of 91.55% and a Top-5 accuracy of 98.56%
|
| 56 |
"""
|
| 57 |
|
| 58 |
-
sample_list = [["
|
| 59 |
|
| 60 |
#Gradio interface
|
| 61 |
demo = gr.Interface(
|
|
|
|
| 9 |
import os
|
| 10 |
import gradio as gr
|
| 11 |
|
| 12 |
+
with open("class_names.txt", 'r') as file:
|
| 13 |
class_names = [line.strip() for line in file]
|
| 14 |
|
| 15 |
|
|
|
|
| 18 |
freeze_gradients=True,
|
| 19 |
unfreeze_blocks=0)
|
| 20 |
|
| 21 |
+
model.load_state_dict(torch.load('vit_b_16_unfreeze_one_encoder_block_10_total_epochs.pth',
|
| 22 |
weights_only=True))
|
| 23 |
|
| 24 |
|
|
|
|
| 55 |
This model achieved a Top-1 accuracy of 91.55% and a Top-5 accuracy of 98.56%
|
| 56 |
"""
|
| 57 |
|
| 58 |
+
sample_list = [["samples/" + sample] for sample in os.listdir("samples")]
|
| 59 |
|
| 60 |
#Gradio interface
|
| 61 |
demo = gr.Interface(
|