Gradio spaces demo deploy
Skill kjuhwa/skills-hub/skills/llm-agents/gradio-spaces-demo-deploy
Deploy a fine-tuned Transformers model as a Gradio web interface and push it to HuggingFace Spaces.From its SKILL.md
npx -y skills add kjuhwa/skills-hub --skill gradio-spaces-demo-deployAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
1.6 KB, 273 tokens by cl100k_base, as published. Nobody here has run it
Deploy a Fine-Tuned Model as a Gradio Spaces Demo
When to use
- You have a fine-tuned model and want a shareable web demo without a dedicated server.
- Host for free on HuggingFace Spaces using the Gradio SDK.
Steps
-
Create a new Gradio Space at https://huggingface.co/new-space?sdk=gradio
-
Write app.py:
import gradio as gr
from transformers import pipeline
classifier = pipeline("text-classification", model="./model")
def predict(text):
result = classifier(text)[0]
return result["label"], result["score"]
demo = gr.Interface(fn=predict, inputs="text", outputs=["label", "number"])
demo.launch()
-
Create requirements.txt with pinned transformers and torch versions.
-
Upload app.py, requirements.txt, and model files to your Space.
-
The Space builds and launches automatically.
Example
Reference demo: https://huggingface.co/spaces/cooelf/text-classification
Pitfalls
- HuggingFace Spaces may require a VPN in China.
- Large model files may exceed free-tier storage; load model by Hub ID instead.
Source
- Chapter 1 of dive-into-llms - documents/chapter1/README.md
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.