File size: 670 Bytes
1f0bfad
254a8fa
 
 
ceb5aaf
a37c17d
1beb286
479597e
1beb286
a37c17d
479597e
 
 
 
1beb286
479597e
 
 
422f59b
1beb286
479597e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#level 4 text generator
import gradio as gr
from transformers import pipeline

generator = pipeline('text-generation', model='bigscience/bloom-560m')

def generate(text):
    result = generator(text) #max_length=100, num_return_sequences=1
    return result[0]["generated_text"]

#examples = [
#    ["Zoe Kwan is a 20-year old singer and songwriter who has taken Hong Kong’s music scene by storm."],
#    ["Zoe only recently began writing songs."],
#]

#lines=5, label="Input Text"
#label="Generated Text"
#title="Text Generator Bloom-560M", examples=examples
gr.Interface(fn=generate, inputs=gr.inputs.Textbox(), outputs=gr.outputs.Textbox()).launch()

#demo.launch()