Spaces:
Running
Running
File size: 900 Bytes
32b0450 d97db75 528c89f 7fc842c 61505d3 7fc842c 351b9e5 d97db75 44f8057 351b9e5 081ad0c 44f8057 7fc842c 351b9e5 44f8057 8065197 351b9e5 7fc842c 351b9e5 |
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 |
import gradio as gr
from transformers import pipeline, set_seed
import random
generator = pipeline('text-generation', model='jslin09/bloom-560m-finetuned-fraud')
def generate(text):
seed = random.randint(10, 500)
set_seed(seed)
result = generator(text, max_length=500, num_return_sequences=1)
return result[0]["generated_text"]
examples = [
["闕很大明知金融帳戶之存摺、提款卡及密碼係供自己使用之重要理財工具,"],
["森上梅前明知其無資力支付酒店消費,亦無付款意願,竟意圖為自己不法之所有,"],
["王大明意圖為自己不法所有,基於竊盜之犯意,"]
]
demo = gr.Interface(
fn=generate,
title="Legal Document Drafting",
inputs=gr.inputs.Textbox(lines=5, label="輸入提示文字"),
outputs=gr.outputs.Textbox(label="生成的文本"),
examples=examples
)
demo.launch()
|