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