Spaces:
Runtime error
Runtime error
pyesonekyaw
commited on
Commit
•
bd30f13
1
Parent(s):
dbe3a8c
revert theming as no support on hfs yet
Browse files- app.py +62 -62
- requirements.txt +1 -1
app.py
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
from __future__ import annotations
|
2 |
import gradio as gr
|
3 |
from huggingface_hub import from_pretrained_fastai
|
4 |
import os
|
5 |
from typing import Iterable
|
6 |
-
from gradio.themes.base import Base
|
7 |
-
from gradio.themes.utils import colors, fonts, sizes
|
8 |
|
9 |
os.environ["HF_ENDPOINT"] = "https://huggingface.co"
|
10 |
|
@@ -76,65 +76,65 @@ paper_item_num_dict = {
|
|
76 |
"Tissue Paper": ["No, dispose as general waste","Nil"]
|
77 |
}
|
78 |
|
79 |
-
class Seafoam(Base):
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
seafoam = Seafoam()
|
138 |
|
139 |
def predict_image(inp):
|
140 |
"""
|
@@ -184,7 +184,7 @@ def predict_image(inp):
|
|
184 |
raise Exception("Invalid file format! Please only upload .jpg or .png files!")
|
185 |
|
186 |
|
187 |
-
with gr.Blocks(title="Trash Classification", css="#custom_header {min-height: 3rem} #custom_title {min-height: 3rem; text-align: center}"
|
188 |
gr.Markdown("# Check whether your trash is recyclable or not!", elem_id="custom_title")
|
189 |
gr.Markdown("Gradio Inference interface for classification of trash and recyclables. To use it, simply upload your image, or click one of the examples to load them. Images uploaded are never saved or indexed.", elem_id="custom_title")
|
190 |
|
|
|
1 |
+
# from __future__ import annotations
|
2 |
import gradio as gr
|
3 |
from huggingface_hub import from_pretrained_fastai
|
4 |
import os
|
5 |
from typing import Iterable
|
6 |
+
# from gradio.themes.base import Base
|
7 |
+
# from gradio.themes.utils import colors, fonts, sizes
|
8 |
|
9 |
os.environ["HF_ENDPOINT"] = "https://huggingface.co"
|
10 |
|
|
|
76 |
"Tissue Paper": ["No, dispose as general waste","Nil"]
|
77 |
}
|
78 |
|
79 |
+
# class Seafoam(Base):
|
80 |
+
# def __init__(
|
81 |
+
# self,
|
82 |
+
# *,
|
83 |
+
# primary_hue: colors.Color | str = colors.emerald,
|
84 |
+
# secondary_hue: colors.Color | str = colors.teal,
|
85 |
+
# neutral_hue: colors.Color | str = colors.teal,
|
86 |
+
# spacing_size: sizes.Size | str = sizes.spacing_md,
|
87 |
+
# radius_size: sizes.Size | str = sizes.radius_md,
|
88 |
+
# text_size: sizes.Size | str = sizes.text_lg,
|
89 |
+
# font: fonts.Font
|
90 |
+
# | str
|
91 |
+
# | Iterable[fonts.Font | str] = (
|
92 |
+
# fonts.GoogleFont("Quicksand"),
|
93 |
+
# "ui-sans-serif",
|
94 |
+
# "sans-serif",
|
95 |
+
# ),
|
96 |
+
# font_mono: fonts.Font
|
97 |
+
# | str
|
98 |
+
# | Iterable[fonts.Font | str] = (
|
99 |
+
# fonts.GoogleFont("IBM Plex Mono"),
|
100 |
+
# "ui-monospace",
|
101 |
+
# "monospace",
|
102 |
+
# ),
|
103 |
+
# ):
|
104 |
+
# super().__init__(
|
105 |
+
# primary_hue=primary_hue,
|
106 |
+
# secondary_hue=secondary_hue,
|
107 |
+
# neutral_hue=neutral_hue,
|
108 |
+
# spacing_size=spacing_size,
|
109 |
+
# radius_size=radius_size,
|
110 |
+
# text_size=text_size,
|
111 |
+
# font=font,
|
112 |
+
# font_mono=font_mono,
|
113 |
+
# )
|
114 |
|
115 |
+
# super().set(
|
116 |
+
# body_background_fill="linear-gradient(45deg, *primary_200, *primary_200 10px, *primary_50 10px, *primary_50 20px)",
|
117 |
+
# body_background_fill_dark="linear-gradient(45deg, *primary_200, *primary_200 10px, *primary_50 10px, *primary_50 20px)",
|
118 |
+
# stat_background_fill_dark="linear-gradient(to right, *primary_400, *primary_200)",
|
119 |
+
# error_background_fill_dark=f"linear-gradient(to right, {colors.red.c100}, *background_fill_secondary)",
|
120 |
+
# button_primary_background_fill="linear-gradient(90deg, *primary_300, *secondary_400)",
|
121 |
+
# button_primary_background_fill_hover="linear-gradient(90deg, *primary_200, *secondary_300)",
|
122 |
+
# button_primary_background_fill_hover_dark="linear-gradient(90deg, *primary_200, *secondary_300)",
|
123 |
+
# button_primary_text_color="white",
|
124 |
+
# button_primary_background_fill_dark="linear-gradient(90deg, *primary_300, *secondary_400)",
|
125 |
+
# slider_color="*secondary_300",
|
126 |
+
# slider_color_dark="*secondary_300",
|
127 |
+
# block_title_text_weight="600",
|
128 |
+
# block_border_width="3px",
|
129 |
+
# block_shadow="*shadow_drop_lg",
|
130 |
+
# button_shadow="*shadow_drop_lg",
|
131 |
+
# button_large_padding="32px",
|
132 |
+
# )
|
133 |
+
# for k in list(self.__dict__.keys()):
|
134 |
+
# if '_dark' in k:
|
135 |
+
# setattr(self,k,None)
|
136 |
+
|
137 |
+
# seafoam = Seafoam()
|
138 |
|
139 |
def predict_image(inp):
|
140 |
"""
|
|
|
184 |
raise Exception("Invalid file format! Please only upload .jpg or .png files!")
|
185 |
|
186 |
|
187 |
+
with gr.Blocks(title="Trash Classification", css="#custom_header {min-height: 3rem} #custom_title {min-height: 3rem; text-align: center}") as demo:#, theme=seafoam) as demo:
|
188 |
gr.Markdown("# Check whether your trash is recyclable or not!", elem_id="custom_title")
|
189 |
gr.Markdown("Gradio Inference interface for classification of trash and recyclables. To use it, simply upload your image, or click one of the examples to load them. Images uploaded are never saved or indexed.", elem_id="custom_title")
|
190 |
|
requirements.txt
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
gradio
|
2 |
huggingface_hub
|
3 |
fastai
|
|
|
1 |
+
gradio
|
2 |
huggingface_hub
|
3 |
fastai
|