Spaces:
Sleeping
Sleeping
File size: 375 Bytes
f759ca3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
import gradio as gr
from transformers import pipeline
# Use an existing model from Hugging Face
model = pipeline("text-generation", model="gpt2") # Replace 'gpt2' with the model you want
def predict(text):
result = model(text, max_length=100)[0]["generated_text"]
return result
# Simple Gradio app
gr.Interface(fn=predict, inputs="text", outputs="text").launch()
|