Spaces:
Sleeping
Sleeping
File size: 492 Bytes
46f9206 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
from transformers import pipeline
import torch
import gradio as gr
pipeline = pipeline("text-generation", model = "distilbert/distilgpt2")
def generate_text(text:str):
"""Complete the text
Input:
Text : Given some Initial word.
Output:
Complete the text till the max length.
"""
return pipeline(text, max_length=50, truncation=True)
demo = gr.Interface(
generate_text,
inputs=["text"],
outputs=["json"]
)
demo.launch(mcp_server = True) |