Galuh commited on
Commit
2b4c283
1 Parent(s): 0326f75

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -51,7 +51,7 @@ st.title("Indonesian GPT-2")
51
 
52
  st.sidebar.subheader("Configurable parameters")
53
 
54
- max_len = st.sidebar.text_input(
55
  "Maximum length",
56
  value=100,
57
  help="The maximum length of the sequence to be generated."
@@ -65,13 +65,13 @@ temp = st.sidebar.slider(
65
  help="The value used to module the next token probabilities."
66
  )
67
 
68
- top_k = st.sidebar.text_input(
69
  "Top k",
70
  value=50,
71
  help="The number of highest probability vocabulary tokens to keep for top-k-filtering."
72
  )
73
 
74
- top_p = st.sidebar.text_input(
75
  "Top p",
76
  value=0.95,
77
  help=" If set to float < 1, only the most probable tokens with probabilities that add up to top_p or higher are kept for generation."
@@ -116,6 +116,10 @@ if st.button("Run"):
116
  st.write(f'{error}')
117
  else:
118
  result = result[0]["generated_text"]
119
- st.write(result.replace("\n", " \n"))
 
 
120
  st.text("English translation")
121
- st.write(translate(result, "en", "id").replace("\n", " \n"))
 
 
 
51
 
52
  st.sidebar.subheader("Configurable parameters")
53
 
54
+ max_len = st.sidebar.number_input(
55
  "Maximum length",
56
  value=100,
57
  help="The maximum length of the sequence to be generated."
 
65
  help="The value used to module the next token probabilities."
66
  )
67
 
68
+ top_k = st.sidebar.number_input(
69
  "Top k",
70
  value=50,
71
  help="The number of highest probability vocabulary tokens to keep for top-k-filtering."
72
  )
73
 
74
+ top_p = st.sidebar.number_input(
75
  "Top p",
76
  value=0.95,
77
  help=" If set to float < 1, only the most probable tokens with probabilities that add up to top_p or higher are kept for generation."
 
116
  st.write(f'{error}')
117
  else:
118
  result = result[0]["generated_text"]
119
+ st.write(result.replace("\
120
+ ", " \
121
+ "))
122
  st.text("English translation")
123
+ st.write(translate(result, "en", "id").replace("\
124
+ ", " \
125
+ "))