Update post_generator.py
Browse files- post_generator.py +64 -28
post_generator.py
CHANGED
@@ -18,43 +18,79 @@ def generate_post(length, language, tag, selected_tone=None):
|
|
18 |
response = llm.invoke(prompt)
|
19 |
post_content = response.content
|
20 |
|
21 |
-
# Add closing statements dynamically based on tone
|
22 |
closing_lines = {
|
23 |
-
"Motivational":
|
24 |
-
"
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
"
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
"
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
"
|
45 |
-
|
46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
}
|
48 |
|
49 |
if selected_tone and selected_tone in closing_lines:
|
50 |
-
|
|
|
|
|
|
|
|
|
|
|
51 |
import random
|
52 |
-
post_content += f"\n\n{random.choice(
|
53 |
|
54 |
return post_content
|
55 |
|
56 |
|
57 |
-
|
58 |
def get_prompt(length, language, tag):
|
59 |
length_str = get_length_str(length)
|
60 |
|
|
|
18 |
response = llm.invoke(prompt)
|
19 |
post_content = response.content
|
20 |
|
21 |
+
# Add closing statements dynamically based on tone and language
|
22 |
closing_lines = {
|
23 |
+
"Motivational": {
|
24 |
+
"English": [
|
25 |
+
"Stay inspired and keep moving forward! πͺ",
|
26 |
+
"Your journey to greatness begins today. π",
|
27 |
+
"Remember, small steps lead to big achievements. π",
|
28 |
+
"Keep pushing your boundaries. Youβve got this! π₯"
|
29 |
+
],
|
30 |
+
"Hinglish": [
|
31 |
+
"Dhire dhire aage badho aur safalta pao! πͺ",
|
32 |
+
"Sapne bade rakho, unhe pura karo. π",
|
33 |
+
"Chhoti chhoti koshis se bade lakshya hasil hote hain! π",
|
34 |
+
"Apne boundaries todho, aap kar sakte ho! π₯"
|
35 |
+
]
|
36 |
+
},
|
37 |
+
"Professional": {
|
38 |
+
"English": [
|
39 |
+
"Looking forward to hearing your thoughts! π",
|
40 |
+
"Letβs collaborate and make an impact together. π",
|
41 |
+
"Feel free to share your perspective below. π’",
|
42 |
+
"Insights and feedback are always welcome. π‘"
|
43 |
+
],
|
44 |
+
"Hinglish": [
|
45 |
+
"Aapke vichar sunne ka intezaar hai! π",
|
46 |
+
"Chaliye milkar kuch asar karte hain. π",
|
47 |
+
"Neeche apne vichar zaroor share karein. π’",
|
48 |
+
"Aapka feedback hamare liye mahatvapurn hai. π‘"
|
49 |
+
]
|
50 |
+
},
|
51 |
+
"Informal": {
|
52 |
+
"English": [
|
53 |
+
"What do you think? Let's chat in the comments! π",
|
54 |
+
"Drop your thoughts below, would love to hear from you! π¨οΈ",
|
55 |
+
"Letβs keep the conversation rolling. Share your views! π",
|
56 |
+
"Got something to add? Donβt hold back! π"
|
57 |
+
],
|
58 |
+
"Hinglish": [
|
59 |
+
"Kya sochte ho? Comments mein baat karte hain! π",
|
60 |
+
"Apne vichar neeche likho, sunne ke liye excited hoon! π¨οΈ",
|
61 |
+
"Charcha ko jaari rakhein, apne vichar share karein! π",
|
62 |
+
"Kuch add karna hai? Sharmana mat, batao! π"
|
63 |
+
]
|
64 |
+
},
|
65 |
+
"Neutral": {
|
66 |
+
"English": [
|
67 |
+
"Thank you for reading. Your feedback is valued! π",
|
68 |
+
"Letβs connect and share ideas. π",
|
69 |
+
"Looking forward to engaging with you in the comments. π¬",
|
70 |
+
"Your thoughts are always appreciated. π"
|
71 |
+
],
|
72 |
+
"Hinglish": [
|
73 |
+
"Padhne ke liye dhanyavaad. Aapka feedback mahatvapurn hai! π",
|
74 |
+
"Chaliye judein aur naye ideas share karein. π",
|
75 |
+
"Aapke vichar comments mein padhne ka intezaar hai. π¬",
|
76 |
+
"Aapke sujhav hamesha sarankrit hote hain. π"
|
77 |
+
]
|
78 |
+
}
|
79 |
}
|
80 |
|
81 |
if selected_tone and selected_tone in closing_lines:
|
82 |
+
if language == "Hinglish" and "Hinglish" in closing_lines[selected_tone]:
|
83 |
+
closing_line = closing_lines[selected_tone]["Hinglish"]
|
84 |
+
else:
|
85 |
+
closing_line = closing_lines[selected_tone]["English"]
|
86 |
+
|
87 |
+
# Randomly select a closing line
|
88 |
import random
|
89 |
+
post_content += f"\n\n{random.choice(closing_line)}"
|
90 |
|
91 |
return post_content
|
92 |
|
93 |
|
|
|
94 |
def get_prompt(length, language, tag):
|
95 |
length_str = get_length_str(length)
|
96 |
|