0-ma commited on
Commit
2c0a33a
·
verified ·
1 Parent(s): 479feb3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -3
app.py CHANGED
@@ -27,13 +27,25 @@ models = {
27
 
28
  }
29
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  # Load the default model
31
  #feature_extractor = AutoImageProcessor.from_pretrained(models["Tiny Model"])
32
  #model = AutoModelForImageClassification.from_pretrained(models["Tiny Model"])
33
 
34
 
35
- feature_extractors = { model_name : AutoImageProcessor.from_pretrained(models[model_name]) for model_name in models}
36
- classification_models = { model_name : AutoModelForImageClassification.from_pretrained(models[model_name]) for model_name in models}
37
 
38
 
39
  def predict(image, selected_model):
@@ -73,7 +85,7 @@ examples = [
73
  # Adding a dropdown for model selection
74
  gr.Interface(
75
  fn=predict,
76
- inputs=[gr.Image(type="pil"), gr.Dropdown(list(models.keys()), label="Select Model")],
77
  outputs=gr.Label(),
78
  title=title,
79
  description=description,
 
27
 
28
  }
29
 
30
+ model_names = [
31
+ "0-ma/swin-geometric-shapes-tiny",
32
+ "0-ma/mobilenet-v2-geometric-shapes",
33
+ "0-ma/focalnet-geometric-shapes-tiny",
34
+ "0-ma/efficientnet-b2-geometric-shapes",
35
+ "0-ma/beit-geometric-shapes-base",
36
+ "0-ma/mit-b0-geometric-shapes",
37
+ "0-ma/vit-geometric-shapes-base",
38
+ "0-ma/resnet-geometric-shapes",
39
+ "0-ma/vit-geometric-shapes-tiny",
40
+ ]
41
+
42
  # Load the default model
43
  #feature_extractor = AutoImageProcessor.from_pretrained(models["Tiny Model"])
44
  #model = AutoModelForImageClassification.from_pretrained(models["Tiny Model"])
45
 
46
 
47
+ feature_extractors = { model_name : AutoImageProcessor.from_pretrained(model_name) for model_name in model_names}
48
+ classification_models = { model_name : AutoModelForImageClassification.from_pretrained(model_name) for model_name in model_names}
49
 
50
 
51
  def predict(image, selected_model):
 
85
  # Adding a dropdown for model selection
86
  gr.Interface(
87
  fn=predict,
88
+ inputs=[gr.Image(type="pil"), gr.Dropdown(model_names), label="Select Model")],
89
  outputs=gr.Label(),
90
  title=title,
91
  description=description,