Aruno commited on
Commit
ac14b21
1 Parent(s): b335e45

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +32 -9
app.py CHANGED
@@ -1,18 +1,41 @@
1
  import streamlit as st
2
  from transformers import pipeline
3
 
4
- pipeline = pipeline(task="text-generation", model="Aruno/Bloom-JP-160m")
 
 
5
 
6
- st.title("日本語のテキスト生成")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
  with st.form("my_form"):
9
- title = st.text_input('入力', '宇宙に行って、')
10
- min_length = st.slider("生成最小数", min_value=1, value=16)
11
- max_length = st.slider("生成最大数", min_value=1, value=32)
12
- num_beams = st.slider("Beam数",min_value=1, max_value=10, value=3)
13
- num_output = st.slider("応答数",min_value=1, max_value=10, value=3)
14
 
15
- submitted = st.form_submit_button("生成")
16
  if submitted:
17
- predictions = pipeline(title, min_length=min_length, max_length=max_length, num_beams=num_beams, num_return_sequences=num_output)
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)