Spaces:
Sleeping
Sleeping
Upload with huggingface_hub
Browse files
README.md
CHANGED
@@ -1,12 +1,11 @@
|
|
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: gradio
|
7 |
-
sdk_version: 3.
|
8 |
-
app_file:
|
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_extended_step_4
|
4 |
+
emoji: 🔥
|
5 |
+
colorFrom: indigo
|
6 |
+
colorTo: indigo
|
7 |
sdk: gradio
|
8 |
+
sdk_version: 3.22.0
|
9 |
+
app_file: run.py
|
10 |
pinned: false
|
11 |
---
|
|
|
|
run.ipynb
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"cells": [{"cell_type": "markdown", "id": 302934307671667531413257853548643485645, "metadata": {}, "source": ["# Gradio Demo: theme_extended_step_4"]}, {"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", "import time\n", "\n", "theme = gr.themes.Default(primary_hue=\"blue\").set(\n", " loader_color=\"#FF0000\",\n", " slider_color=\"#FF0000\",\n", ")\n", "\n", "with gr.Blocks(\n", " theme=theme\n", ") 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,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import time
|
3 |
+
|
4 |
+
theme = gr.themes.Default(primary_hue="blue").set(
|
5 |
+
loader_color="#FF0000",
|
6 |
+
slider_color="#FF0000",
|
7 |
+
)
|
8 |
+
|
9 |
+
with gr.Blocks(
|
10 |
+
theme=theme
|
11 |
+
) as demo:
|
12 |
+
textbox = gr.Textbox(label="Name")
|
13 |
+
slider = gr.Slider(label="Count", minimum=0, maximum=100, step=1)
|
14 |
+
with gr.Row():
|
15 |
+
button = gr.Button("Submit", variant="primary")
|
16 |
+
clear = gr.Button("Clear")
|
17 |
+
output = gr.Textbox(label="Output")
|
18 |
+
|
19 |
+
def repeat(name, count):
|
20 |
+
time.sleep(3)
|
21 |
+
return name * count
|
22 |
+
|
23 |
+
button.click(repeat, [textbox, slider], output)
|
24 |
+
|
25 |
+
if __name__ == "__main__":
|
26 |
+
demo.launch()
|