Spaces:
Runtime error
Runtime error
Galuh
commited on
Commit
•
2b4c283
1
Parent(s):
0326f75
Update app.py
Browse files
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.
|
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.
|
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.
|
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("\
|
|
|
|
|
120 |
st.text("English translation")
|
121 |
-
st.write(translate(result, "en", "id").replace("\
|
|
|
|
|
|
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 |
+
"))
|