Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,4 +3,24 @@ from transformers import T5Tokenizer, T5ForConditionalGeneration
|
|
3 |
|
4 |
# Carregar o modelo T5-small e o tokenizer
|
5 |
tokenizer = T5Tokenizer.from_pretrained("t5-small")
|
6 |
-
model = T5ForConditionalGeneration.from_pretrained("t5-small")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
# Carregar o modelo T5-small e o tokenizer
|
5 |
tokenizer = T5Tokenizer.from_pretrained("t5-small")
|
6 |
+
model = T5ForConditionalGeneration.from_pretrained("t5-small")
|
7 |
+
|
8 |
+
# T铆tulo da p谩gina
|
9 |
+
st.title("Humanizador de Texto")
|
10 |
+
|
11 |
+
# Caixa de texto para o usu谩rio digitar
|
12 |
+
input_text = st.text_area("Cole seu texto de rob么 aqui:")
|
13 |
+
|
14 |
+
# Bot茫o para humanizar
|
15 |
+
if st.button("Humanizar"):
|
16 |
+
if input_text:
|
17 |
+
# Pedir ao rob么 para humanizar o texto
|
18 |
+
input_ids = tokenizer(f"humanize: {input_text}", return_tensors="pt").input_ids
|
19 |
+
outputs = model.generate(input_ids, max_length=512)
|
20 |
+
humanized_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
21 |
+
|
22 |
+
# Mostrar o texto humanizado
|
23 |
+
st.success("Texto humanizado:")
|
24 |
+
st.write(humanized_text)
|
25 |
+
else:
|
26 |
+
st.warning("Por favor, cole um texto de rob么 primeiro!")
|