Update post_generator.py
Browse files- post_generator.py +6 -6
post_generator.py
CHANGED
@@ -25,11 +25,11 @@ def generate_closing_line(language, tag, tone):
|
|
25 |
- Use the language: "{language}" (Hinglish means Hindi phrases written in English script).
|
26 |
Examples:
|
27 |
- Topic: "Job Search", Tone: "Motivational", Language: "English"
|
28 |
-
Closing Line: "Your dream job is closer than you think. Stay determined! π"
|
29 |
- Topic: "Mental Health", Tone: "Professional", Language: "English"
|
30 |
-
Closing Line: "Your mental well-being is essential. Letβs discuss ways to manage stress. π‘"
|
31 |
- Topic: "Dating", Tone: "Informal", Language: "Hinglish"
|
32 |
-
Closing Line: "Apka perfect date idea kya hai? Neeche share karein! π"
|
33 |
Now, write a relevant closing line for the following inputs:
|
34 |
Topic: "{tag}"
|
35 |
Tone: "{tone}"
|
@@ -51,12 +51,12 @@ def generate_post(length, language, tag, selected_tone=None):
|
|
51 |
if selected_tone and tag:
|
52 |
try:
|
53 |
closing_line = generate_closing_line(language, tag, selected_tone)
|
54 |
-
post_content += f"\n\n
|
55 |
except Exception as e:
|
56 |
# Fallback in case of LLM failure
|
57 |
post_content += f"\n\nThank you for reading. Your feedback is valued! π"
|
58 |
|
59 |
-
return post_content
|
60 |
|
61 |
|
62 |
def get_prompt(length, language, tag):
|
@@ -82,4 +82,4 @@ def get_prompt(length, language, tag):
|
|
82 |
|
83 |
|
84 |
if __name__ == "__main__":
|
85 |
-
print(generate_post("Medium", "English", "Mental Health"))
|
|
|
25 |
- Use the language: "{language}" (Hinglish means Hindi phrases written in English script).
|
26 |
Examples:
|
27 |
- Topic: "Job Search", Tone: "Motivational", Language: "English"
|
28 |
+
Closing Line: "Your dream job is closer than you think. Stay determined! π #DreamJob #StayMotivated"
|
29 |
- Topic: "Mental Health", Tone: "Professional", Language: "English"
|
30 |
+
Closing Line: "Your mental well-being is essential. Letβs discuss ways to manage stress. π‘ #MentalHealth #StressManagement"
|
31 |
- Topic: "Dating", Tone: "Informal", Language: "Hinglish"
|
32 |
+
Closing Line: "Apka perfect date idea kya hai? Neeche share karein! π #DatingTips #FunDates"
|
33 |
Now, write a relevant closing line for the following inputs:
|
34 |
Topic: "{tag}"
|
35 |
Tone: "{tone}"
|
|
|
51 |
if selected_tone and tag:
|
52 |
try:
|
53 |
closing_line = generate_closing_line(language, tag, selected_tone)
|
54 |
+
post_content += f"\n\n{closing_line}" # Append the closing line with hashtags
|
55 |
except Exception as e:
|
56 |
# Fallback in case of LLM failure
|
57 |
post_content += f"\n\nThank you for reading. Your feedback is valued! π"
|
58 |
|
59 |
+
return post_content # Ensure the returned content has hashtags only from the LLM
|
60 |
|
61 |
|
62 |
def get_prompt(length, language, tag):
|
|
|
82 |
|
83 |
|
84 |
if __name__ == "__main__":
|
85 |
+
print(generate_post("Medium", "English", "Mental Health"))
|