Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -95,7 +95,7 @@ if name == 'Topic Classification':
|
|
95 |
col2.bar_chart(chart_data)
|
96 |
|
97 |
elif name == 'Date Prediction':
|
98 |
-
st.markdown("## Predict Date")
|
99 |
if text:
|
100 |
with st.spinner('processing..'):
|
101 |
text = RegexSubstitution(r'\([^()]+\)|[<>\'"β³β²β‘β ]')(text)
|
@@ -104,13 +104,13 @@ elif name == 'Date Prediction':
|
|
104 |
raw_input_ids + [tokenizer.eos_token_id]
|
105 |
outputs = model.generate(torch.tensor([input_ids]),
|
106 |
early_stopping=True,
|
107 |
-
repetition_penalty=2.0,
|
108 |
do_sample=True, #μνλ§ μ λ΅ μ¬μ©
|
109 |
max_length=50, # μ΅λ λμ½λ© κΈΈμ΄λ 50
|
110 |
top_k=50, # νλ₯ μμκ° 50μ λ°μΈ ν ν°μ μνλ§μμ μ μΈ
|
111 |
top_p=0.95, # λμ νλ₯ μ΄ 95%μΈ ν보μ§ν©μμλ§ μμ±
|
112 |
num_return_sequences=3 #3κ°μ κ²°κ³Όλ₯Ό λμ½λ©ν΄λΈλ€
|
113 |
)
|
|
|
114 |
for output in outputs:
|
115 |
-
pred_print
|
116 |
-
|
|
|
95 |
col2.bar_chart(chart_data)
|
96 |
|
97 |
elif name == 'Date Prediction':
|
98 |
+
st.markdown("## Predict 3 possible Date")
|
99 |
if text:
|
100 |
with st.spinner('processing..'):
|
101 |
text = RegexSubstitution(r'\([^()]+\)|[<>\'"β³β²β‘β ]')(text)
|
|
|
104 |
raw_input_ids + [tokenizer.eos_token_id]
|
105 |
outputs = model.generate(torch.tensor([input_ids]),
|
106 |
early_stopping=True,
|
|
|
107 |
do_sample=True, #μνλ§ μ λ΅ μ¬μ©
|
108 |
max_length=50, # μ΅λ λμ½λ© κΈΈμ΄λ 50
|
109 |
top_k=50, # νλ₯ μμκ° 50μ λ°μΈ ν ν°μ μνλ§μμ μ μΈ
|
110 |
top_p=0.95, # λμ νλ₯ μ΄ 95%μΈ ν보μ§ν©μμλ§ μμ±
|
111 |
num_return_sequences=3 #3κ°μ κ²°κ³Όλ₯Ό λμ½λ©ν΄λΈλ€
|
112 |
)
|
113 |
+
pred_print = []
|
114 |
for output in outputs:
|
115 |
+
pred_print.append(tokenizer.decode(output.squeeze().tolist(), skip_special_tokens=True, clean_up_tokenization_spaces=True))
|
116 |
+
st.write(", ".join(pred_print))
|