File size: 772 Bytes
a3b9f76
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import streamlit as st
from transformers import pipeline

pipeline = pipeline(task="text-generation", model="Aruno/Bloom-JP-160m")

st.title("日本語のテキスト生成")

with st.form("my_form"):
   title = st.text_input('入力', '宇宙に行って、')
   min_length = st.slider("生成最小数", min_value=1, value=16)
   max_length = st.slider("生成最大数", min_value=1, value=32)
   num_beams = st.slider("Beam数",min_value=1, max_value=10, value=3)
   num_output = st.slider("応答数",min_value=1, max_value=10, value=3)

   submitted = st.form_submit_button("生成")
   if submitted:
       predictions = pipeline(title, min_length=min_length, max_length=max_length, num_beams=num_beams, num_return_sequences=num_output)
       st.write(predictions)