Spaces:
Runtime error
Runtime error
Commit
·
6aa3774
1
Parent(s):
adb1cfa
Fixed indentation error
Browse files- apps/summarization.py +47 -47
apps/summarization.py
CHANGED
@@ -19,54 +19,54 @@ def write():
|
|
19 |
|
20 |
# Sidebar
|
21 |
|
22 |
-
|
23 |
-
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
|
71 |
input_text = st.text_area(label='Enter a text: ', height=200,
|
72 |
value="Kalp krizi geçirenlerin yaklaşık üçte birinin kısa bir süre önce grip atlattığı düşünülüyor. Peki grip virüsü ne yapıyor da kalp krizine yol açıyor? Karpuz şöyle açıkladı: Grip virüsü kanın yapışkanlığını veya pıhtılaşmasını artırıyor.")
|
|
|
19 |
|
20 |
# Sidebar
|
21 |
|
22 |
+
# Taken from https://huggingface.co/spaces/flax-community/spanish-gpt2/blob/main/app.py
|
23 |
+
st.sidebar.subheader("Configurable parameters")
|
24 |
|
25 |
+
model_name = st.sidebar.selectbox(
|
26 |
+
"Model Selector",
|
27 |
+
options=[
|
28 |
+
"turna_summarization_mlsum",
|
29 |
+
"turna_summarization_tr_news",
|
30 |
+
],
|
31 |
+
index=0,
|
32 |
+
)
|
33 |
+
max_new_tokens = st.sidebar.number_input(
|
34 |
+
"Maximum length",
|
35 |
+
min_value=0,
|
36 |
+
max_value=128,
|
37 |
+
value=128,
|
38 |
+
help="The maximum length of the sequence to be generated.",
|
39 |
+
)
|
40 |
+
length_penalty = st.sidebar.number_input(
|
41 |
+
"Length penalty",
|
42 |
+
value=2.0,
|
43 |
+
help=" length_penalty > 0.0 promotes longer sequences, while length_penalty < 0.0 encourages shorter sequences. ",
|
44 |
+
)
|
45 |
+
"""do_sample = st.sidebar.selectbox(
|
46 |
+
"Sampling?",
|
47 |
+
(True, False),
|
48 |
+
help="Whether or not to use sampling; use greedy decoding otherwise.",
|
49 |
+
)
|
50 |
+
num_beams = st.sidebar.number_input(
|
51 |
+
"Number of beams",
|
52 |
+
min_value=1,
|
53 |
+
max_value=10,
|
54 |
+
value=3,
|
55 |
+
help="The number of beams to use for beam search.",
|
56 |
+
)
|
57 |
+
repetition_penalty = st.sidebar.number_input(
|
58 |
+
"Repetition Penalty",
|
59 |
+
min_value=0.0,
|
60 |
+
value=3.0,
|
61 |
+
step=0.1,
|
62 |
+
help="The parameter for repetition penalty. 1.0 means no penalty",
|
63 |
+
)"""
|
64 |
+
no_repeat_ngram_size = st.sidebar.number_input(
|
65 |
+
"No Repeat N-Gram Size",
|
66 |
+
min_value=0,
|
67 |
+
value=3,
|
68 |
+
help="If set to int > 0, all ngrams of that size can only occur once.",
|
69 |
+
)
|
70 |
|
71 |
input_text = st.text_area(label='Enter a text: ', height=200,
|
72 |
value="Kalp krizi geçirenlerin yaklaşık üçte birinin kısa bir süre önce grip atlattığı düşünülüyor. Peki grip virüsü ne yapıyor da kalp krizine yol açıyor? Karpuz şöyle açıkladı: Grip virüsü kanın yapışkanlığını veya pıhtılaşmasını artırıyor.")
|