jslin09's picture
Update app.py
dad4f76
raw
history blame
703 Bytes
import gradio as gr
from transformers import pipeline
generator = pipeline('text-generation', model='jslin09/bloom-560m-finetuned-fraud')
def generate(text):
result = generator(text, max_length=300, num_return_sequences=1)
return result[0]["generated_text"]
examples = [
["闕很大明知金融帳戶之存摺、提款卡及密碼係供自己使用之重要理財工具,"],
["森上梅前明知其無資力支付酒店消費,亦無付款意願,竟意圖為自己不法之所有,"]
]
demo = gr.Interface(
fn=generate,
inputs=gr.inputs.Textbox(lines=5, label="Input Text"),
outputs=gr.outputs.Textbox(label="Generated Text"),
examples=examples
)
demo.launch()