prithivMLmods commited on
Commit
71a123f
·
verified ·
1 Parent(s): f0a2c2f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +42 -1
app.py CHANGED
@@ -1,6 +1,8 @@
1
  import gradio as gr
2
  import torch
3
  import spaces
 
 
4
  from transformers import AutoModel, AutoProcessor
5
 
6
  from gender_classification import gender_classification
@@ -19,6 +21,45 @@ from rice_leaf_disease import classify_leaf_disease
19
  from traffic_density import traffic_density_classification
20
  from clip_art import clipart_classification # New import
21
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  # Main classification function for multi-model classification.
23
  def classify(image, model_name):
24
  if model_name == "gender":
@@ -105,7 +146,7 @@ def infer(image, candidate_labels):
105
  return postprocess_siglip(sg1_probs, sg2_probs, labels=candidate_labels)
106
 
107
  # Build the Gradio Interface with two tabs.
108
- with gr.Blocks(theme=gr.themes.Default(primary_hue=gr.themes.colors.red, secondary_hue=gr.themes.colors.pink)) as demo:
109
  gr.Markdown("# Multi-Domain & Zero-Shot Image Classification")
110
 
111
  with gr.Tabs():
 
1
  import gradio as gr
2
  import torch
3
  import spaces
4
+ from gradio.themes.base import Base
5
+ from gradio.themes.utils import colors, fonts, sizes
6
  from transformers import AutoModel, AutoProcessor
7
 
8
  from gender_classification import gender_classification
 
21
  from traffic_density import traffic_density_classification
22
  from clip_art import clipart_classification # New import
23
 
24
+ #Gradio-Theme
25
+ class Seafoam(Base):
26
+ def __init__(
27
+ self,
28
+ *,
29
+ primary_hue: colors.Color | str = colors.emerald,
30
+ secondary_hue: colors.Color | str = colors.blue,
31
+ neutral_hue: colors.Color | str = colors.gray,
32
+ spacing_size: sizes.Size | str = sizes.spacing_md,
33
+ radius_size: sizes.Size | str = sizes.radius_md,
34
+ text_size: sizes.Size | str = sizes.text_lg,
35
+ font: fonts.Font
36
+ | str
37
+ | Iterable[fonts.Font | str] = (
38
+ fonts.GoogleFont("Quicksand"),
39
+ "ui-sans-serif",
40
+ "sans-serif",
41
+ ),
42
+ font_mono: fonts.Font
43
+ | str
44
+ | Iterable[fonts.Font | str] = (
45
+ fonts.GoogleFont("IBM Plex Mono"),
46
+ "ui-monospace",
47
+ "monospace",
48
+ ),
49
+ ):
50
+ super().__init__(
51
+ primary_hue=primary_hue,
52
+ secondary_hue=secondary_hue,
53
+ neutral_hue=neutral_hue,
54
+ spacing_size=spacing_size,
55
+ radius_size=radius_size,
56
+ text_size=text_size,
57
+ font=font,
58
+ font_mono=font_mono,
59
+ )
60
+
61
+ seafoam = Seafoam()
62
+
63
  # Main classification function for multi-model classification.
64
  def classify(image, model_name):
65
  if model_name == "gender":
 
146
  return postprocess_siglip(sg1_probs, sg2_probs, labels=candidate_labels)
147
 
148
  # Build the Gradio Interface with two tabs.
149
+ with gr.Blocks(theme=seafoam) as demo:
150
  gr.Markdown("# Multi-Domain & Zero-Shot Image Classification")
151
 
152
  with gr.Tabs():