Update app.py
Browse files
app.py
CHANGED
@@ -1,18 +1,41 @@
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline
|
3 |
|
4 |
-
|
|
|
|
|
5 |
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
with st.form("my_form"):
|
9 |
-
|
10 |
-
min_length = st.slider(
|
11 |
-
max_length = st.slider(
|
12 |
-
num_beams = st.slider(
|
13 |
-
num_output = st.slider(
|
14 |
|
15 |
-
submitted = st.form_submit_button(
|
16 |
if submitted:
|
17 |
-
predictions = pipeline(
|
18 |
st.write(predictions)
|
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline
|
3 |
|
4 |
+
option = st.selectbox(
|
5 |
+
'Choisissez votre langue / 言語を選択',
|
6 |
+
('Français', '日本語'))
|
7 |
|
8 |
+
if option == "Français":
|
9 |
+
pipeline = pipeline(task="text-generation", model="Aruno/Bloom-FR-160m")
|
10 |
+
title_str = "Génération de texte en français"
|
11 |
+
min_length_str = "Longueur minimum"
|
12 |
+
max_length_str = "Longueur maximum"
|
13 |
+
num_beams_str = "Nombre de beam"
|
14 |
+
num_output_str = "Nombre de réponse"
|
15 |
+
submitted_str = "Génération"
|
16 |
+
input_value_str1 = 'Entrée'
|
17 |
+
input_value_str2 = 'Je vais dans'
|
18 |
+
else:
|
19 |
+
pipeline = pipeline(task="text-generation", model="Aruno/Bloom-JP-160m")
|
20 |
+
title_str = "日本語のテキスト生成"
|
21 |
+
min_length_str = "生成最小数"
|
22 |
+
max_length_str = "生成最大数"
|
23 |
+
num_beams_str = "Beam数"
|
24 |
+
num_output_str = "応答数"
|
25 |
+
submitted_str = "生成"
|
26 |
+
input_value_str1 = '入力'
|
27 |
+
input_value_str2 = '宇宙に行って、'
|
28 |
+
|
29 |
+
st.title(title_str)
|
30 |
|
31 |
with st.form("my_form"):
|
32 |
+
input_value = st.text_input(input_value_str1, input_value_str2)
|
33 |
+
min_length = st.slider(min_length_str, min_value=1, value=16)
|
34 |
+
max_length = st.slider(max_length_str, min_value=1, value=32)
|
35 |
+
num_beams = st.slider(num_beams_str, min_value=1, max_value=10, value=3)
|
36 |
+
num_output = st.slider(num_output_str, min_value=1, max_value=10, value=3)
|
37 |
|
38 |
+
submitted = st.form_submit_button(submitted_str)
|
39 |
if submitted:
|
40 |
+
predictions = pipeline(input_value, min_length=min_length, max_length=max_length, num_beams=num_beams, num_return_sequences=num_output)
|
41 |
st.write(predictions)
|