import gradio as gr from transformers import pipeline, set_seed import random generator = pipeline('text-generation', model='jslin09/bloom-560m-finetuned-fraud') def rnd_generate(text): rnd_seed = random.randint(10, 500) set_seed(rnd_seed) result = generator(text, max_length=500, num_return_sequences=1, do_sample=True, temperature=0.75, top_k=50, top_p=0.9) return result[0]["generated_text"] def generate(text): set_seed(55) result = generator(text, max_length=500, num_return_sequences=1, do_sample=True, temperature=0.75, top_k=50, top_p=0.9) return result[0]["generated_text"] examples = [ ["闕很大明知金融帳戶之存摺、提款卡及密碼係供自己使用之重要理財工具,"], ["森上梅前明知其無資力支付酒店消費,亦無付款意願,竟意圖為自己不法之所有,"], ["王大明意圖為自己不法所有,基於竊盜之犯意,"], ["假住院病患企圖住院以詐領保險住院理賠金"] ] with gr.Blocks() as demo: gr.Markdown( """