islasher commited on
Commit
4372bca
·
verified ·
1 Parent(s): 85b6188

Update LLMPipeline.py

Browse files
Files changed (1) hide show
  1. LLMPipeline.py +2 -1
LLMPipeline.py CHANGED
@@ -78,9 +78,10 @@ def generate_image_prompt_viejo(summary):
78
  prompt = f"Crea un prompt para imagen tipo meme sobre este titular de noticias:\n{summary}\nEl prompt debe ser corto, visual y gracioso. Devuelve solo el prompt."
79
  result = text_generator(prompt, max_new_tokens=400, do_sample=True, temperature=0.7)[0]['generated_text']
80
  return result.strip()
 
81
  tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-small")
82
  model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-small")
83
- from transformers import T5Tokenizer, T5ForConditionalGeneration
84
  def generate_image_prompt(summary):
85
  input_text = f"Create a prompt for image generation. Should be a meme. Short, visual and funny. Related to: {summary}"
86
  input_ids = tokenizer(input_text, return_tensors="pt").input_ids
 
78
  prompt = f"Crea un prompt para imagen tipo meme sobre este titular de noticias:\n{summary}\nEl prompt debe ser corto, visual y gracioso. Devuelve solo el prompt."
79
  result = text_generator(prompt, max_new_tokens=400, do_sample=True, temperature=0.7)[0]['generated_text']
80
  return result.strip()
81
+ from transformers import T5Tokenizer, T5ForConditionalGeneration
82
  tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-small")
83
  model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-small")
84
+
85
  def generate_image_prompt(summary):
86
  input_text = f"Create a prompt for image generation. Should be a meme. Short, visual and funny. Related to: {summary}"
87
  input_ids = tokenizer(input_text, return_tensors="pt").input_ids