metadata
base_model: google-t5/t5-base
datasets:
- gokaygokay/prompt-enhancer-dataset
language:
- en
library_name: transformers
license: apache-2.0
pipeline_tag: text2text-generation
from transformers import pipeline, AutoTokenizer, AutoModelForSeq2SeqLM
device = "cuda" if torch.cuda.is_available() else "cpu"
# Model checkpoint
model_checkpoint = "gokaygokay/Flux-Prompt-Enhance"
# Tokenizer
tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)
# Model
model = AutoModelForSeq2SeqLM.from_pretrained(model_checkpoint)
enhancer = pipeline('text2text-generation',
model=model,
tokenizer=tokenizer,
device=device)
max_target_length = 256
prefix = "enhance prompt: "
short_prompt = "beautiful house with text 'hello'"
answer = enhancer(prefix + short_prompt, max_length=max_target_length)
final_answer = answer[0]['generated_text']
print(final_answer)
# a two-story house with white walls and dark wooden beams, the house has "hello' written in large black letters on the front wall, there is a small balcony with a glass railing above it, a tree with green leaves is to the left of the house, a stone pathway leads up from the bottom center towards the entrance of the house, a tall palm tree stands to the right side of the house, another smaller tree is to its left, a clear blue sky with scattered clouds fills most of the background, some shadows are cast by the trees and the house.