Spaces:
Running
Running
Upload folder using huggingface_hub
Browse files- requirements.txt +2 -2
- run.ipynb +1 -1
- run.py +1 -1
requirements.txt
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
gradio-client @ git+https://github.com/gradio-app/gradio@
|
2 |
-
https://gradio-pypi-previews.s3.amazonaws.com/
|
|
|
1 |
+
gradio-client @ git+https://github.com/gradio-app/gradio@1299267a8a78546d3f9e13d6b3c58231cf88f2b9#subdirectory=client/python
|
2 |
+
https://gradio-pypi-previews.s3.amazonaws.com/1299267a8a78546d3f9e13d6b3c58231cf88f2b9/gradio-5.16.0-py3-none-any.whl
|
run.ipynb
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: blocks_sidebar"]}, {"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 random\n", "\n", "def generate_pet_name(animal_type, personality):\n", " cute_prefixes = [\"Fluffy\", \"Ziggy\", \"Bubbles\", \"Pickle\", \"Waffle\", \"Mochi\", \"Cookie\", \"Pepper\"]\n", " animal_suffixes = {\n", " \"Cat\": [\"Whiskers\", \"Paws\", \"Mittens\", \"Purrington\"],\n", " \"Dog\": [\"Woofles\", \"Barkington\", \"Waggins\", \"Pawsome\"],\n", " \"Bird\": [\"Feathers\", \"Wings\", \"Chirpy\", \"Tweets\"],\n", " \"Rabbit\": [\"Hops\", \"Cottontail\", \"Bouncy\", \"Fluff\"]\n", " }\n", "\n", " prefix = random.choice(cute_prefixes)\n", " suffix = random.choice(animal_suffixes[animal_type])\n", "\n", " if personality == \"Silly\":\n", " prefix = random.choice([\"Sir\", \"Lady\", \"Captain\", \"Professor\"]) + \" \" + prefix\n", " elif personality == \"Royal\":\n", " suffix += \" the \" + random.choice([\"Great\", \"Magnificent\", \"Wise\", \"Brave\"])\n", "\n", " return f\"{prefix} {suffix}\"\n", "\n", "with gr.Blocks(theme=gr.themes.Soft()) as demo:\n", " with gr.Sidebar():\n", " gr.Markdown(\"# \ud83d\udc3e Pet Name Generator\")\n", " gr.Markdown(\"Use the options below to generate a unique pet name!\")\n", "\n", " animal_type = gr.Dropdown(\n", " choices=[\"Cat\", \"Dog\", \"Bird\", \"Rabbit\"],\n", " label=\"Choose your pet type\",\n", " value=\"Cat\"\n", " )\n", " personality = gr.Radio(\n", " choices=[\"Normal\", \"Silly\", \"Royal\"],\n", " label=\"Personality type\",\n", " value=\"Normal\"\n", " )\n", "\n", " name_output = gr.Textbox(label=\"Your pet's fancy name:\", lines=2)\n", " generate_btn = gr.Button(\"Generate Name! \ud83c\udfb2\", variant=\"primary\")\n", " generate_btn.click(\n", " fn=generate_pet_name,\n", " inputs=[animal_type, personality],\n", " outputs=name_output\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: blocks_sidebar"]}, {"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 random\n", "\n", "def generate_pet_name(animal_type, personality):\n", " cute_prefixes = [\"Fluffy\", \"Ziggy\", \"Bubbles\", \"Pickle\", \"Waffle\", \"Mochi\", \"Cookie\", \"Pepper\"]\n", " animal_suffixes = {\n", " \"Cat\": [\"Whiskers\", \"Paws\", \"Mittens\", \"Purrington\"],\n", " \"Dog\": [\"Woofles\", \"Barkington\", \"Waggins\", \"Pawsome\"],\n", " \"Bird\": [\"Feathers\", \"Wings\", \"Chirpy\", \"Tweets\"],\n", " \"Rabbit\": [\"Hops\", \"Cottontail\", \"Bouncy\", \"Fluff\"]\n", " }\n", "\n", " prefix = random.choice(cute_prefixes)\n", " suffix = random.choice(animal_suffixes[animal_type])\n", "\n", " if personality == \"Silly\":\n", " prefix = random.choice([\"Sir\", \"Lady\", \"Captain\", \"Professor\"]) + \" \" + prefix\n", " elif personality == \"Royal\":\n", " suffix += \" the \" + random.choice([\"Great\", \"Magnificent\", \"Wise\", \"Brave\"])\n", "\n", " return f\"{prefix} {suffix}\"\n", "\n", "with gr.Blocks(theme=gr.themes.Soft()) as demo:\n", " with gr.Sidebar(position=\"left\"):\n", " gr.Markdown(\"# \ud83d\udc3e Pet Name Generator\")\n", " gr.Markdown(\"Use the options below to generate a unique pet name!\")\n", "\n", " animal_type = gr.Dropdown(\n", " choices=[\"Cat\", \"Dog\", \"Bird\", \"Rabbit\"],\n", " label=\"Choose your pet type\",\n", " value=\"Cat\"\n", " )\n", " personality = gr.Radio(\n", " choices=[\"Normal\", \"Silly\", \"Royal\"],\n", " label=\"Personality type\",\n", " value=\"Normal\"\n", " )\n", "\n", " name_output = gr.Textbox(label=\"Your pet's fancy name:\", lines=2)\n", " generate_btn = gr.Button(\"Generate Name! \ud83c\udfb2\", variant=\"primary\")\n", " generate_btn.click(\n", " fn=generate_pet_name,\n", " inputs=[animal_type, personality],\n", " outputs=name_output\n", " )\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
|
run.py
CHANGED
@@ -21,7 +21,7 @@ def generate_pet_name(animal_type, personality):
|
|
21 |
return f"{prefix} {suffix}"
|
22 |
|
23 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
24 |
-
with gr.Sidebar():
|
25 |
gr.Markdown("# 🐾 Pet Name Generator")
|
26 |
gr.Markdown("Use the options below to generate a unique pet name!")
|
27 |
|
|
|
21 |
return f"{prefix} {suffix}"
|
22 |
|
23 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
24 |
+
with gr.Sidebar(position="left"):
|
25 |
gr.Markdown("# 🐾 Pet Name Generator")
|
26 |
gr.Markdown("Use the options below to generate a unique pet name!")
|
27 |
|