freddyaboulton HF Staff commited on
Commit
acf3b4d
·
verified ·
1 Parent(s): b6e830b

Upload folder using huggingface_hub

Browse files
Files changed (5) hide show
  1. README.md +1 -1
  2. custom_css.css +64 -0
  3. requirements.txt +2 -2
  4. run.ipynb +1 -1
  5. run.py +2 -69
README.md CHANGED
@@ -5,7 +5,7 @@ emoji: 🔥
5
  colorFrom: indigo
6
  colorTo: indigo
7
  sdk: gradio
8
- sdk_version: 5.49.1
9
  app_file: run.py
10
  pinned: false
11
  hf_oauth: true
 
5
  colorFrom: indigo
6
  colorTo: indigo
7
  sdk: gradio
8
+ sdk_version: 6.0.0
9
  app_file: run.py
10
  pinned: false
11
  hf_oauth: true
custom_css.css ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* CSSKeyframesRule for animation */
2
+ @keyframes animation {
3
+ from {background-color: red;}
4
+ to {background-color: blue;}
5
+ }
6
+
7
+ .cool-col {
8
+ background-color: red;
9
+ animation-name: animation;
10
+ animation-duration: 4s;
11
+ animation-delay: 2s;
12
+ animation-iteration-count: infinite;
13
+ border-radius: 10px;
14
+ padding: 20px;
15
+ }
16
+
17
+ /* CSSStyleRule */
18
+ .markdown {
19
+ background-color: lightblue;
20
+ padding: 20px;
21
+ }
22
+
23
+ .markdown p {
24
+ color: royalblue;
25
+ }
26
+
27
+ /* CSSMediaRule */
28
+ @media screen and (max-width: 600px) {
29
+ .markdown {
30
+ background: blue;
31
+ }
32
+ .markdown p {
33
+ color: lightblue;
34
+ }
35
+ }
36
+
37
+ .dark .markdown {
38
+ background: pink;
39
+ }
40
+
41
+ .darktest h3 {
42
+ color: black;
43
+ }
44
+
45
+ .dark .darktest h3 {
46
+ color: yellow;
47
+ }
48
+
49
+ /* CSSFontFaceRule */
50
+ @font-face {
51
+ font-family: "test-font";
52
+ src: url("https://mdn.github.io/css-examples/web-fonts/VeraSeBd.ttf") format("truetype");
53
+ }
54
+
55
+ .cool-col {
56
+ font-family: "test-font";
57
+ }
58
+
59
+ /* CSSImportRule */
60
+ @import url("https://fonts.googleapis.com/css2?family=Protest+Riot&display=swap");
61
+
62
+ .markdown {
63
+ font-family: "Protest Riot", sans-serif;
64
+ }
requirements.txt CHANGED
@@ -1,2 +1,2 @@
1
- gradio-client @ git+https://github.com/gradio-app/gradio@e05eb8df38a4ca20993e94ca4e209cf8110bb677#subdirectory=client/python
2
- https://gradio-pypi-previews.s3.amazonaws.com/e05eb8df38a4ca20993e94ca4e209cf8110bb677/gradio-5.49.1-py3-none-any.whl
 
1
+ gradio-client @ git+https://github.com/gradio-app/gradio@d007e6cf617baba5c62e49ec2b7ce278aa863a79#subdirectory=client/python
2
+ https://gradio-pypi-previews.s3.amazonaws.com/d007e6cf617baba5c62e49ec2b7ce278aa863a79/gradio-6.0.0-py3-none-any.whl
run.ipynb CHANGED
@@ -1 +1 @@
1
- {"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: custom_css"]}, {"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": ["import gradio as gr\n", "\n", "css = \"\"\"\n", "/* CSSKeyframesRule for animation */\n", "@keyframes animation {\n", " from {background-color: red;}\n", " to {background-color: blue;}\n", "}\n", "\n", ".cool-col {\n", " background-color: red;\n", " animation-name: animation;\n", " animation-duration: 4s;\n", " animation-delay: 2s;\n", " animation-iteration-count: infinite;\n", " border-radius: 10px;\n", " padding: 20px;\n", "}\n", "\n", "/* CSSStyleRule */\n", ".markdown {\n", " background-color: lightblue;\n", " padding: 20px;\n", "}\n", "\n", ".markdown p {\n", " color: royalblue;\n", "}\n", "\n", "/* CSSMediaRule */\n", "@media screen and (max-width: 600px) {\n", " .markdown {\n", " background: blue;\n", " }\n", " .markdown p {\n", " color: lightblue;\n", " }\n", "}\n", "\n", ".dark .markdown {\n", " background: pink;\n", "}\n", "\n", ".darktest h3 {\n", " color: black;\n", "}\n", "\n", ".dark .darktest h3 {\n", " color: yellow;\n", "}\n", "\n", "/* CSSFontFaceRule */\n", "@font-face {\n", " font-family: \"test-font\";\n", " src: url(\"https://mdn.github.io/css-examples/web-fonts/VeraSeBd.ttf\") format(\"truetype\");\n", "}\n", "\n", ".cool-col {\n", " font-family: \"test-font\";\n", "}\n", "\n", "/* CSSImportRule */\n", "@import url(\"https://fonts.googleapis.com/css2?family=Protest+Riot&display=swap\");\n", "\n", ".markdown {\n", " font-family: \"Protest Riot\", sans-serif;\n", "}\n", "\"\"\"\n", "\n", "with gr.Blocks(css=css) as demo:\n", " with gr.Column(elem_classes=\"cool-col\"):\n", " gr.Markdown(\"### Gradio Demo with Custom CSS\", elem_classes=\"darktest\")\n", " gr.Markdown(\n", " elem_classes=\"markdown\",\n", " value=\"Resize the browser window to see the CSS media query in action.\",\n", " )\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
 
1
+ {"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: custom_css"]}, {"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": ["# Downloading files from the demo repo\n", "import os\n", "!wget -q https://github.com/gradio-app/gradio/raw/main/demo/custom_css/custom_css.css"]}, {"cell_type": "code", "execution_count": null, "id": "44380577570523278879349135829904343037", "metadata": {}, "outputs": [], "source": ["import gradio as gr\n", "\n", "with gr.Blocks() as demo:\n", " with gr.Column(elem_classes=\"cool-col\"):\n", " gr.Markdown(\"### Gradio Demo with Custom CSS\", elem_classes=\"darktest\")\n", " gr.Markdown(\n", " elem_classes=\"markdown\",\n", " value=\"Resize the browser window to see the CSS media query in action.\",\n", " )\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch(css_paths=[\"demo/custom_css/custom_css.css\"])\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
run.py CHANGED
@@ -1,73 +1,6 @@
1
  import gradio as gr
2
 
3
- css = """
4
- /* CSSKeyframesRule for animation */
5
- @keyframes animation {
6
- from {background-color: red;}
7
- to {background-color: blue;}
8
- }
9
-
10
- .cool-col {
11
- background-color: red;
12
- animation-name: animation;
13
- animation-duration: 4s;
14
- animation-delay: 2s;
15
- animation-iteration-count: infinite;
16
- border-radius: 10px;
17
- padding: 20px;
18
- }
19
-
20
- /* CSSStyleRule */
21
- .markdown {
22
- background-color: lightblue;
23
- padding: 20px;
24
- }
25
-
26
- .markdown p {
27
- color: royalblue;
28
- }
29
-
30
- /* CSSMediaRule */
31
- @media screen and (max-width: 600px) {
32
- .markdown {
33
- background: blue;
34
- }
35
- .markdown p {
36
- color: lightblue;
37
- }
38
- }
39
-
40
- .dark .markdown {
41
- background: pink;
42
- }
43
-
44
- .darktest h3 {
45
- color: black;
46
- }
47
-
48
- .dark .darktest h3 {
49
- color: yellow;
50
- }
51
-
52
- /* CSSFontFaceRule */
53
- @font-face {
54
- font-family: "test-font";
55
- src: url("https://mdn.github.io/css-examples/web-fonts/VeraSeBd.ttf") format("truetype");
56
- }
57
-
58
- .cool-col {
59
- font-family: "test-font";
60
- }
61
-
62
- /* CSSImportRule */
63
- @import url("https://fonts.googleapis.com/css2?family=Protest+Riot&display=swap");
64
-
65
- .markdown {
66
- font-family: "Protest Riot", sans-serif;
67
- }
68
- """
69
-
70
- with gr.Blocks(css=css) as demo:
71
  with gr.Column(elem_classes="cool-col"):
72
  gr.Markdown("### Gradio Demo with Custom CSS", elem_classes="darktest")
73
  gr.Markdown(
@@ -76,4 +9,4 @@ with gr.Blocks(css=css) as demo:
76
  )
77
 
78
  if __name__ == "__main__":
79
- demo.launch()
 
1
  import gradio as gr
2
 
3
+ with gr.Blocks() as demo:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  with gr.Column(elem_classes="cool-col"):
5
  gr.Markdown("### Gradio Demo with Custom CSS", elem_classes="darktest")
6
  gr.Markdown(
 
9
  )
10
 
11
  if __name__ == "__main__":
12
+ demo.launch(css_paths=["demo/custom_css/custom_css.css"])