SakibRumu commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,6 +4,80 @@ import gradio as gr
|
|
| 4 |
#import pathlib
|
| 5 |
#temp=pathlib.PosixPath
|
| 6 |
#pathlib.PosixPath=pathlib.WindowsPath
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
|
| 9 |
food_labels = [
|
|
|
|
| 4 |
#import pathlib
|
| 5 |
#temp=pathlib.PosixPath
|
| 6 |
#pathlib.PosixPath=pathlib.WindowsPath
|
| 7 |
+
# Custom Seafoam theme
|
| 8 |
+
from gradio.themes.base import Base
|
| 9 |
+
from gradio.themes.utils import colors, fonts, sizes
|
| 10 |
+
|
| 11 |
+
class Seafoam(Base):
|
| 12 |
+
def __init__(
|
| 13 |
+
self,
|
| 14 |
+
*,
|
| 15 |
+
primary_hue: colors.Color | str = colors.emerald,
|
| 16 |
+
secondary_hue: colors.Color | str = colors.blue,
|
| 17 |
+
neutral_hue: colors.Color | str = colors.blue,
|
| 18 |
+
spacing_size: sizes.Size | str = sizes.spacing_md,
|
| 19 |
+
radius_size: sizes.Size | str = sizes.radius_md,
|
| 20 |
+
text_size: sizes.Size | str = sizes.text_lg,
|
| 21 |
+
font: fonts.Font | str | Iterable[fonts.Font | str] = (
|
| 22 |
+
fonts.GoogleFont("Quicksand"),
|
| 23 |
+
"ui-sans-serif",
|
| 24 |
+
"sans-serif",
|
| 25 |
+
),
|
| 26 |
+
font_mono: fonts.Font | str | Iterable[fonts.Font | str] = (
|
| 27 |
+
fonts.GoogleFont("IBM Plex Mono"),
|
| 28 |
+
"ui-monospace",
|
| 29 |
+
"monospace",
|
| 30 |
+
),
|
| 31 |
+
):
|
| 32 |
+
super().__init__(
|
| 33 |
+
primary_hue=primary_hue,
|
| 34 |
+
secondary_hue=secondary_hue,
|
| 35 |
+
neutral_hue=neutral_hue,
|
| 36 |
+
spacing_size=spacing_size,
|
| 37 |
+
radius_size=radius_size,
|
| 38 |
+
text_size=text_size,
|
| 39 |
+
font=font,
|
| 40 |
+
font_mono=font_mono,
|
| 41 |
+
)
|
| 42 |
+
super().set(
|
| 43 |
+
body_background_fill="repeating-linear-gradient(45deg, *primary_200, *primary_200 10px, *primary_50 10px, *primary_50 20px)",
|
| 44 |
+
body_background_fill_dark="repeating-linear-gradient(45deg, *primary_800, *primary_800 10px, *primary_900 10px, *primary_900 20px)",
|
| 45 |
+
button_primary_background_fill="linear-gradient(90deg, *primary_300, *secondary_400)",
|
| 46 |
+
button_primary_background_fill_hover="linear-gradient(90deg, *primary_200, *secondary_300)",
|
| 47 |
+
button_primary_text_color="white",
|
| 48 |
+
button_primary_background_fill_dark="linear-gradient(90deg, *primary_600, *secondary_800)",
|
| 49 |
+
slider_color="*secondary_300",
|
| 50 |
+
slider_color_dark="*secondary_600",
|
| 51 |
+
block_title_text_weight="600",
|
| 52 |
+
block_border_width="3px",
|
| 53 |
+
block_shadow="*shadow_drop_lg",
|
| 54 |
+
button_shadow="*shadow_drop_lg",
|
| 55 |
+
button_large_padding="32px",
|
| 56 |
+
)
|
| 57 |
+
|
| 58 |
+
seafoam = Seafoam()
|
| 59 |
+
|
| 60 |
+
css = """
|
| 61 |
+
body {
|
| 62 |
+
overflow-y: auto;
|
| 63 |
+
height: 100vh;
|
| 64 |
+
margin: 0;
|
| 65 |
+
}
|
| 66 |
+
.container {
|
| 67 |
+
display: flex;
|
| 68 |
+
flex-direction: column;
|
| 69 |
+
height: 100%;
|
| 70 |
+
}
|
| 71 |
+
.content {
|
| 72 |
+
flex: 1;
|
| 73 |
+
overflow-y: auto;
|
| 74 |
+
}
|
| 75 |
+
.submit-button-container {
|
| 76 |
+
display: flex;
|
| 77 |
+
justify-content: flex-end;
|
| 78 |
+
padding: 10px;
|
| 79 |
+
}
|
| 80 |
+
"""
|
| 81 |
|
| 82 |
|
| 83 |
food_labels = [
|