Views
No views yet
1from transformers import pipeline
2classifier = pipeline("sentiment-analysis", model="chaukhaphan/my-first-hf-model")
3classifier("I love deploying models!")
4
5
6
7You can edit it:
8- Locally and `git push`
9- Or directly on the Hugging Face web UI
10
11---
12
13## 🚀 3. **Create a Live Web Demo with Gradio (Space)**
14
15This lets non-technical users interact with your model via a **drag-and-drop UI**.
16
17### How:
18
191. Go to: [https://huggingface.co/spaces](https://huggingface.co/spaces)
202. Click **Create new Space**
213. Choose:
22 - SDK: **Gradio**
23 - Name: e.g., `my-sentiment-app`
24 - Hardware: CPU is fine
254. Create `app.py`:
26
27```python
28import gradio as gr
29from transformers import pipeline
30
31clf = pipeline("sentiment-analysis", model="chaukhaphan/my-first-hf-model")
32
33def analyze(text):
34 return clf(text)[0]
35
36gr.Interface(fn=analyze, inputs="text", outputs="label", title="Sentiment Analyzer").launch()