File size: 629 Bytes
61e98c3
 
 
2dbd061
 
 
 
 
 
61e98c3
 
 
 
 
2dbd061
61e98c3
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr
from transformers import pipeline

generator = pipeline(
    "text-generation",
    model="cyberagent/open-calm-small",
    tokenizer="cyberagent/open-calm-small",
)


def generate(text):
    result = generator(text)
    return result[0]["generated_text"]


examples = [
    ["AIによって私達の暮らしは、"],
]

demo = gr.Interface(
    fn=generate,
    inputs=gr.Textbox(lines=5, label="Input Text"),
    outputs=gr.Textbox(lines=5, label="Generated Text"),
    examples=examples,
    description="# [CyberAgent OpenCALM-Small](https://huggingface.co/cyberagent/open-calm-small)",
)

demo.launch()