DrishtiSharma commited on
Commit
49c324c
Β·
verified Β·
1 Parent(s): f7a52fb

Update post_generator.py

Browse files
Files changed (1) hide show
  1. 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
- "Stay inspired and keep moving forward! πŸ’ͺ",
25
- "Your journey to greatness begins today. 🌟",
26
- "Remember, small steps lead to big achievements. πŸš€",
27
- "Keep pushing your boundaries. You’ve got this! πŸ”₯"
28
- ],
29
- "Professional": [
30
- "Looking forward to hearing your thoughts! πŸ‘”",
31
- "Let’s collaborate and make an impact together. 🌐",
32
- "Feel free to share your perspective below. πŸ“’",
33
- "Insights and feedback are always welcome. πŸ’‘"
34
- ],
35
- "Informal": [
36
- "What do you think? Let's chat in the comments! πŸ˜„",
37
- "Drop your thoughts below, would love to hear from you! πŸ—¨οΈ",
38
- "Let’s keep the conversation rolling. Share your views! πŸš€",
39
- "Got something to add? Don’t hold back! 😎"
40
- ],
41
- "Neutral": [
42
- "Thank you for reading. Your feedback is valued! πŸ™Œ",
43
- "Let’s connect and share ideas. 🌟",
44
- "Looking forward to engaging with you in the comments. πŸ’¬",
45
- "Your thoughts are always appreciated. 😊"
46
- ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  }
48
 
49
  if selected_tone and selected_tone in closing_lines:
50
- # Randomly select a closing line from the appropriate tone category
 
 
 
 
 
51
  import random
52
- post_content += f"\n\n{random.choice(closing_lines[selected_tone])}"
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