aliabd HF Staff commited on
Commit
c650d95
·
1 Parent(s): c5f79fa

Upload with huggingface_hub

Browse files
Files changed (4) hide show
  1. README.md +6 -7
  2. requirements.txt +2 -0
  3. run.ipynb +1 -0
  4. run.py +63 -0
README.md CHANGED
@@ -1,12 +1,11 @@
 
1
  ---
2
- title: Theme New Step 2 Main
3
- emoji: 🏃
4
- colorFrom: pink
5
- colorTo: gray
6
  sdk: gradio
7
  sdk_version: 3.21.0
8
- app_file: app.py
9
  pinned: false
10
  ---
11
-
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
+
2
  ---
3
+ title: theme_new_step_2_main
4
+ emoji: 🔥
5
+ colorFrom: indigo
6
+ colorTo: indigo
7
  sdk: gradio
8
  sdk_version: 3.21.0
9
+ app_file: run.py
10
  pinned: false
11
  ---
 
 
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+
2
+ https://gradio-main-build.s3.amazonaws.com/de3254fd082c8d23fe3aa345c89538270390db5a/gradio-3.21.0-py3-none-any.whl
run.ipynb ADDED
@@ -0,0 +1 @@
 
 
1
+ {"cells": [{"cell_type": "markdown", "id": 302934307671667531413257853548643485645, "metadata": {}, "source": ["# Gradio Demo: theme_new_step_2"]}, {"cell_type": "code", "execution_count": null, "id": 272996653310673477252411125948039410165, "metadata": {}, "outputs": [], "source": ["!pip install -q gradio "]}, {"cell_type": "code", "execution_count": null, "id": 288918539441861185822528903084949547379, "metadata": {}, "outputs": [], "source": ["from __future__ import annotations\n", "from typing import Iterable\n", "import gradio as gr\n", "from gradio.themes.base import Base\n", "from gradio.themes.utils import colors, fonts, sizes\n", "import time\n", "\n", "\n", "class Seafoam(Base):\n", " def __init__(\n", " self,\n", " *,\n", " primary_hue: colors.Color | str = colors.emerald,\n", " secondary_hue: colors.Color | str = colors.blue,\n", " neutral_hue: colors.Color | str = colors.gray,\n", " spacing_size: sizes.Size | str = sizes.spacing_md,\n", " radius_size: sizes.Size | str = sizes.radius_md,\n", " text_size: sizes.Size | str = sizes.text_lg,\n", " font: fonts.Font\n", " | str\n", " | Iterable[fonts.Font | str] = (\n", " fonts.GoogleFont(\"Quicksand\"),\n", " \"ui-sans-serif\",\n", " \"sans-serif\",\n", " ),\n", " font_mono: fonts.Font\n", " | str\n", " | Iterable[fonts.Font | str] = (\n", " fonts.GoogleFont(\"IBM Plex Mono\"),\n", " \"ui-monospace\",\n", " \"monospace\",\n", " ),\n", " ):\n", " super().__init__(\n", " primary_hue=primary_hue,\n", " secondary_hue=secondary_hue,\n", " neutral_hue=neutral_hue,\n", " spacing_size=spacing_size,\n", " radius_size=radius_size,\n", " text_size=text_size,\n", " font=font,\n", " font_mono=font_mono,\n", " )\n", "\n", "\n", "seafoam = Seafoam()\n", "\n", "with gr.Blocks(theme=seafoam) as demo:\n", " textbox = gr.Textbox(label=\"Name\")\n", " slider = gr.Slider(label=\"Count\", minimum=0, maximum=100, step=1)\n", " with gr.Row():\n", " button = gr.Button(\"Submit\", variant=\"primary\")\n", " clear = gr.Button(\"Clear\")\n", " output = gr.Textbox(label=\"Output\")\n", "\n", " def repeat(name, count):\n", " time.sleep(3)\n", " return name * count\n", "\n", " button.click(repeat, [textbox, slider], output)\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
run.py ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+ from typing import Iterable
3
+ import gradio as gr
4
+ from gradio.themes.base import Base
5
+ from gradio.themes.utils import colors, fonts, sizes
6
+ import time
7
+
8
+
9
+ class Seafoam(Base):
10
+ def __init__(
11
+ self,
12
+ *,
13
+ primary_hue: colors.Color | str = colors.emerald,
14
+ secondary_hue: colors.Color | str = colors.blue,
15
+ neutral_hue: colors.Color | str = colors.gray,
16
+ spacing_size: sizes.Size | str = sizes.spacing_md,
17
+ radius_size: sizes.Size | str = sizes.radius_md,
18
+ text_size: sizes.Size | str = sizes.text_lg,
19
+ font: fonts.Font
20
+ | str
21
+ | Iterable[fonts.Font | str] = (
22
+ fonts.GoogleFont("Quicksand"),
23
+ "ui-sans-serif",
24
+ "sans-serif",
25
+ ),
26
+ font_mono: fonts.Font
27
+ | str
28
+ | Iterable[fonts.Font | str] = (
29
+ fonts.GoogleFont("IBM Plex Mono"),
30
+ "ui-monospace",
31
+ "monospace",
32
+ ),
33
+ ):
34
+ super().__init__(
35
+ primary_hue=primary_hue,
36
+ secondary_hue=secondary_hue,
37
+ neutral_hue=neutral_hue,
38
+ spacing_size=spacing_size,
39
+ radius_size=radius_size,
40
+ text_size=text_size,
41
+ font=font,
42
+ font_mono=font_mono,
43
+ )
44
+
45
+
46
+ seafoam = Seafoam()
47
+
48
+ with gr.Blocks(theme=seafoam) as demo:
49
+ textbox = gr.Textbox(label="Name")
50
+ slider = gr.Slider(label="Count", minimum=0, maximum=100, step=1)
51
+ with gr.Row():
52
+ button = gr.Button("Submit", variant="primary")
53
+ clear = gr.Button("Clear")
54
+ output = gr.Textbox(label="Output")
55
+
56
+ def repeat(name, count):
57
+ time.sleep(3)
58
+ return name * count
59
+
60
+ button.click(repeat, [textbox, slider], output)
61
+
62
+ if __name__ == "__main__":
63
+ demo.launch()