Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -14,6 +14,67 @@ from pytorch_grad_cam.utils.image import show_cam_on_image
|
|
14 |
#ai-pict-detect
|
15 |
from transformers import pipeline
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
pipe = pipeline("image-classification", "nightfury/AI-picture-detector")
|
18 |
|
19 |
def image_classifier(image):
|
@@ -25,9 +86,6 @@ def image_classifier(image):
|
|
25 |
#ai-pict-detect
|
26 |
|
27 |
|
28 |
-
#gr.themes.Soft()
|
29 |
-
#gr.themes.builder()
|
30 |
-
|
31 |
with zipfile.ZipFile("examples.zip","r") as zip_ref:
|
32 |
zip_ref.extractall(".")
|
33 |
|
@@ -125,7 +183,7 @@ interface1 = gr.Interface(
|
|
125 |
gr.outputs.Image(label="Face with Explainability", type="pil")
|
126 |
#ValueError: Invalid value for parameter `type`: auto. Please choose from one of: ['numpy', 'pil', 'filepath']
|
127 |
],
|
128 |
-
theme = gr.themes.Soft(),
|
129 |
title = title,
|
130 |
description = description,
|
131 |
article = article
|
|
|
14 |
#ai-pict-detect
|
15 |
from transformers import pipeline
|
16 |
|
17 |
+
from gradio.themes.base import Base
|
18 |
+
from gradio.themes.utils import colors, fonts, sizes
|
19 |
+
import time
|
20 |
+
|
21 |
+
|
22 |
+
class Seafoam(Base):
|
23 |
+
def __init__(
|
24 |
+
self,
|
25 |
+
*,
|
26 |
+
primary_hue: colors.Color | str = colors.emerald,
|
27 |
+
secondary_hue: colors.Color | str = colors.blue,
|
28 |
+
neutral_hue: colors.Color | str = colors.blue,
|
29 |
+
spacing_size: sizes.Size | str = sizes.spacing_md,
|
30 |
+
radius_size: sizes.Size | str = sizes.radius_md,
|
31 |
+
text_size: sizes.Size | str = sizes.text_lg,
|
32 |
+
font: fonts.Font
|
33 |
+
| str
|
34 |
+
| Iterable[fonts.Font | str] = (
|
35 |
+
fonts.GoogleFont("Quicksand"),
|
36 |
+
"ui-sans-serif",
|
37 |
+
"sans-serif",
|
38 |
+
),
|
39 |
+
font_mono: fonts.Font
|
40 |
+
| str
|
41 |
+
| Iterable[fonts.Font | str] = (
|
42 |
+
fonts.GoogleFont("IBM Plex Mono"),
|
43 |
+
"ui-monospace",
|
44 |
+
"monospace",
|
45 |
+
),
|
46 |
+
):
|
47 |
+
super().__init__(
|
48 |
+
primary_hue=primary_hue,
|
49 |
+
secondary_hue=secondary_hue,
|
50 |
+
neutral_hue=neutral_hue,
|
51 |
+
spacing_size=spacing_size,
|
52 |
+
radius_size=radius_size,
|
53 |
+
text_size=text_size,
|
54 |
+
font=font,
|
55 |
+
font_mono=font_mono,
|
56 |
+
)
|
57 |
+
super().set(
|
58 |
+
body_background_fill="repeating-linear-gradient(45deg, *primary_200, *primary_200 10px, *primary_50 10px, *primary_50 20px)",
|
59 |
+
body_background_fill_dark="repeating-linear-gradient(45deg, *primary_800, *primary_800 10px, *primary_900 10px, *primary_900 20px)",
|
60 |
+
button_primary_background_fill="linear-gradient(90deg, *primary_300, *secondary_400)",
|
61 |
+
button_primary_background_fill_hover="linear-gradient(90deg, *primary_200, *secondary_300)",
|
62 |
+
button_primary_text_color="white",
|
63 |
+
button_primary_background_fill_dark="linear-gradient(90deg, *primary_600, *secondary_800)",
|
64 |
+
slider_color="*secondary_300",
|
65 |
+
slider_color_dark="*secondary_600",
|
66 |
+
block_title_text_weight="600",
|
67 |
+
block_border_width="3px",
|
68 |
+
block_shadow="*shadow_drop_lg",
|
69 |
+
button_shadow="*shadow_drop_lg",
|
70 |
+
button_large_padding="32px",
|
71 |
+
)
|
72 |
+
|
73 |
+
seafoam = Seafoam()
|
74 |
+
gr.themes.Soft()
|
75 |
+
gr.themes.builder()
|
76 |
+
|
77 |
+
|
78 |
pipe = pipeline("image-classification", "nightfury/AI-picture-detector")
|
79 |
|
80 |
def image_classifier(image):
|
|
|
86 |
#ai-pict-detect
|
87 |
|
88 |
|
|
|
|
|
|
|
89 |
with zipfile.ZipFile("examples.zip","r") as zip_ref:
|
90 |
zip_ref.extractall(".")
|
91 |
|
|
|
183 |
gr.outputs.Image(label="Face with Explainability", type="pil")
|
184 |
#ValueError: Invalid value for parameter `type`: auto. Please choose from one of: ['numpy', 'pil', 'filepath']
|
185 |
],
|
186 |
+
theme = seafoam, #gr.themes.Soft(),
|
187 |
title = title,
|
188 |
description = description,
|
189 |
article = article
|