File size: 852 Bytes
dcdaaec
f306d19
55201c0
 
 
 
 
 
 
 
f306d19
ebb0ce9
f306d19
 
 
 
 
 
 
 
425889c
f306d19
 
 
 
 
55201c0
f306d19
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import gradio as gr
from gradio import mix
from transformers import pipeline

generator = pipeline("text-generation", model="distilgpt2")
generator(
    "In this course, we will teach you how to",
    max_length=30,
    num_return_sequences=2,
)


title = "Miniature"
description = "Gradio Demo for a miniature with GPT. To use it, simply add your text, or click one of the examples to load them. Read more at the links below."


examples = [
    ['A kid is playing with']
]

io = gr.Interface.load("huggingface/keras-io/text-generation")



def inference(text):

    return generator(text)
    
     

gr.Interface(
    inference, 
    [gr.inputs.Textbox(label="Input")], 
    gr.outputs.Textbox(label="Output"),
    examples=examples,
    # article=article,
    title=title,
    description=description).launch(enable_queue=True, cache_examples=True)