Spaces:
Sleeping
Sleeping
feat: Use Phi-4-mini-instruct
Browse files
README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
---
|
| 2 |
-
title: Phi-4
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
colorTo: indigo
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 5.29.0
|
|
@@ -9,20 +9,28 @@ app_file: app.py
|
|
| 9 |
pinned: false
|
| 10 |
---
|
| 11 |
|
| 12 |
-
# Phi-4
|
| 13 |
|
| 14 |
-
This is a Gradio
|
| 15 |
|
| 16 |
## π Model
|
| 17 |
|
| 18 |
-
- **Model:** [`microsoft/
|
| 19 |
-
- **
|
|
|
|
| 20 |
|
| 21 |
## π Features
|
| 22 |
|
| 23 |
-
-
|
| 24 |
-
-
|
|
|
|
| 25 |
|
| 26 |
## π¦ Requirements
|
| 27 |
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Phi-4 Mini Instruct Demo
|
| 3 |
+
emoji: π§
|
| 4 |
+
colorFrom: blue
|
| 5 |
colorTo: indigo
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 5.29.0
|
|
|
|
| 9 |
pinned: false
|
| 10 |
---
|
| 11 |
|
| 12 |
+
# Phi-4 Mini Instruct β Hugging Face Space
|
| 13 |
|
| 14 |
+
This Space is a lightweight Gradio demo using the `microsoft/Phi-4-mini-instruct` model from Hugging Face for compact, instruction-tuned language generation.
|
| 15 |
|
| 16 |
## π Model
|
| 17 |
|
| 18 |
+
- **Model:** [`microsoft/Phi-4-mini-instruct`](https://huggingface.co/microsoft/Phi-4-mini-instruct)
|
| 19 |
+
- **Type:** Small, instruction-tuned LLM
|
| 20 |
+
- **Use Case:** Text generation for assistant-style tasks with low resource usage
|
| 21 |
|
| 22 |
## π Features
|
| 23 |
|
| 24 |
+
- Lightweight and fast, great for CPU-only Spaces
|
| 25 |
+
- Simple Gradio interface for trying out prompts
|
| 26 |
+
- Hugging Face `transformers` integration
|
| 27 |
|
| 28 |
## π¦ Requirements
|
| 29 |
|
| 30 |
+
Installed via `requirements.txt`:
|
| 31 |
+
|
| 32 |
+
```txt
|
| 33 |
+
gradio>=5.29.0
|
| 34 |
+
transformers>=4.51.3
|
| 35 |
+
torch
|
| 36 |
+
accelerate
|
app.py
CHANGED
|
@@ -2,7 +2,7 @@ import gradio as gr
|
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
|
| 5 |
-
generator = pipeline("text-generation", model="microsoft/
|
| 6 |
|
| 7 |
def chat_with_phi(prompt):
|
| 8 |
response = generator(prompt, max_new_tokens=200, do_sample=False)[0]["generated_text"]
|
|
|
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
|
| 5 |
+
generator = pipeline("text-generation", model="microsoft/microsoft/Phi-4-mini-instruct", device_map="auto")
|
| 6 |
|
| 7 |
def chat_with_phi(prompt):
|
| 8 |
response = generator(prompt, max_new_tokens=200, do_sample=False)[0]["generated_text"]
|