Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
-
# Load
|
| 5 |
-
model = pipeline("text-generation", model="
|
| 6 |
|
| 7 |
# Define text generation function
|
| 8 |
def generate_text(message, history):
|
|
@@ -15,9 +15,9 @@ def generate_text(message, history):
|
|
| 15 |
# Gradio ChatInterface
|
| 16 |
interface = gr.ChatInterface(
|
| 17 |
fn=generate_text,
|
| 18 |
-
title="
|
| 19 |
-
description="Powered by
|
| 20 |
-
examples=["Hello, how are you?", "Tell me a short
|
| 21 |
)
|
| 22 |
|
| 23 |
# Launch with API endpoint
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
+
# Load distilgpt2 for text generation on CPU
|
| 5 |
+
model = pipeline("text-generation", model="distilgpt2", device="cpu")
|
| 6 |
|
| 7 |
# Define text generation function
|
| 8 |
def generate_text(message, history):
|
|
|
|
| 15 |
# Gradio ChatInterface
|
| 16 |
interface = gr.ChatInterface(
|
| 17 |
fn=generate_text,
|
| 18 |
+
title="DistilGPT2 Chatbot",
|
| 19 |
+
description="Powered by DistilGPT2 on Hugging Face Spaces (CPU Basic). Use API or UI!",
|
| 20 |
+
examples=["Hello, how are you?", "Tell me a short joke", "What’s 2+2?"]
|
| 21 |
)
|
| 22 |
|
| 23 |
# Launch with API endpoint
|