Spaces:
Sleeping
Sleeping
Update LLMPipeline.py
Browse files- LLMPipeline.py +2 -2
LLMPipeline.py
CHANGED
|
@@ -103,8 +103,8 @@ model = AutoModelForCausalLM.from_pretrained(checkpoint).to(device)
|
|
| 103 |
# print(tokenizer.decode(outputs[0]))
|
| 104 |
|
| 105 |
def generate_image_prompt(summary):
|
| 106 |
-
system_prompt_rewrite = "You are a creative meme prompt generator.
|
| 107 |
-
user_prompt_rewrite = "Create a meme prompt from the message
|
| 108 |
messages = [{"role": "system", "content": system_prompt_rewrite}, {"role": "user", "content":f"{user_prompt_rewrite} {summary}"}]
|
| 109 |
input_text=tokenizer.apply_chat_template(messages, tokenize=False)
|
| 110 |
inputs = tokenizer.encode(input_text, return_tensors="pt").to(device)
|
|
|
|
| 103 |
# print(tokenizer.decode(outputs[0]))
|
| 104 |
|
| 105 |
def generate_image_prompt(summary):
|
| 106 |
+
system_prompt_rewrite = "You are a creative meme prompt generator. Create a visual prompt to generate a meme of a message. Do not return any text other than the new prompt."
|
| 107 |
+
user_prompt_rewrite = "Create a visual meme prompt from the message. Keep its main point.\nThe message:"
|
| 108 |
messages = [{"role": "system", "content": system_prompt_rewrite}, {"role": "user", "content":f"{user_prompt_rewrite} {summary}"}]
|
| 109 |
input_text=tokenizer.apply_chat_template(messages, tokenize=False)
|
| 110 |
inputs = tokenizer.encode(input_text, return_tensors="pt").to(device)
|