ChatBot / app.py
Aruno's picture
Update app.py
ac14b21
import streamlit as st
from transformers import pipeline
option = st.selectbox(
'Choisissez votre langue / 言語を選択',
('Français', '日本語'))
if option == "Français":
pipeline = pipeline(task="text-generation", model="Aruno/Bloom-FR-160m")
title_str = "Génération de texte en français"
min_length_str = "Longueur minimum"
max_length_str = "Longueur maximum"
num_beams_str = "Nombre de beam"
num_output_str = "Nombre de réponse"
submitted_str = "Génération"
input_value_str1 = 'Entrée'
input_value_str2 = 'Je vais dans'
else:
pipeline = pipeline(task="text-generation", model="Aruno/Bloom-JP-160m")
title_str = "日本語のテキスト生成"
min_length_str = "生成最小数"
max_length_str = "生成最大数"
num_beams_str = "Beam数"
num_output_str = "応答数"
submitted_str = "生成"
input_value_str1 = '入力'
input_value_str2 = '宇宙に行って、'
st.title(title_str)
with st.form("my_form"):
input_value = st.text_input(input_value_str1, input_value_str2)
min_length = st.slider(min_length_str, min_value=1, value=16)
max_length = st.slider(max_length_str, min_value=1, value=32)
num_beams = st.slider(num_beams_str, min_value=1, max_value=10, value=3)
num_output = st.slider(num_output_str, min_value=1, max_value=10, value=3)
submitted = st.form_submit_button(submitted_str)
if submitted:
predictions = pipeline(input_value, min_length=min_length, max_length=max_length, num_beams=num_beams, num_return_sequences=num_output)
st.write(predictions)