DrishtiSharma
commited on
Update post_generator.py
Browse files- post_generator.py +12 -19
post_generator.py
CHANGED
@@ -95,28 +95,21 @@ def get_prompt(length, language, tag):
|
|
95 |
length_str = get_length_str(length)
|
96 |
|
97 |
prompt = f'''
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
If Language is Hinglish then it means it is a mix of Hindi and English.
|
104 |
-
The script for the generated post should always be English.
|
105 |
'''
|
106 |
-
# prompt = prompt.format(post_topic=tag, post_length=length_str, post_language=language)
|
107 |
|
108 |
examples = few_shot.get_filtered_posts(length, language, tag)
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
if i == 1: # Use max two samples
|
118 |
-
break
|
119 |
-
|
120 |
return prompt
|
121 |
|
122 |
|
|
|
95 |
length_str = get_length_str(length)
|
96 |
|
97 |
prompt = f'''
|
98 |
+
Write a professional, engaging LinkedIn post.
|
99 |
+
1. Topic: "{tag}"
|
100 |
+
2. Post Length: "{length_str}"
|
101 |
+
3. Language: "{language}" (Hinglish means Hindi phrases written in English script).
|
102 |
+
4. Incorporate creativity, enthusiasm, emotional appeal, and actionable advice.
|
|
|
|
|
103 |
'''
|
|
|
104 |
|
105 |
examples = few_shot.get_filtered_posts(length, language, tag)
|
106 |
+
if examples:
|
107 |
+
prompt += "\nExamples of great posts:\n"
|
108 |
+
for i, post in enumerate(examples[:2]): # Limit to 2 examples
|
109 |
+
post_text = post['text']
|
110 |
+
prompt += f"Example {i + 1}: {post_text}\n"
|
111 |
+
|
112 |
+
prompt += "\nNow write the post."
|
|
|
|
|
|
|
|
|
113 |
return prompt
|
114 |
|
115 |
|