Spaces:
Sleeping
Sleeping
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!") |