Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -101,6 +101,9 @@ def analyze_personality(text):
|
|
| 101 |
traits = ["openness", "conscientiousness", "extraversion", "agreeableness", "neuroticism"]
|
| 102 |
return {trait: float(prob) for trait, prob in zip(traits, probs[0])}
|
| 103 |
|
|
|
|
|
|
|
|
|
|
| 104 |
def generate_social_post(platform, traits):
|
| 105 |
"""Generate platform-specific social post"""
|
| 106 |
platform_prompts = {
|
|
@@ -122,14 +125,17 @@ def generate_social_post(platform, traits):
|
|
| 122 |
}
|
| 123 |
}
|
| 124 |
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
Include {platform_prompts[platform]['emoji']} emoji and make it {{
|
| 128 |
'instagram': 'visually appealing with hashtags',
|
| 129 |
'linkedin': 'professional and inspiring',
|
| 130 |
'facebook': 'friendly and engaging',
|
| 131 |
'whatsapp': 'casual and fun'
|
| 132 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 133 |
|
| 134 |
response = groq_client.chat.completions.create(
|
| 135 |
model="mixtral-8x7b-32768",
|
|
@@ -138,6 +144,11 @@ def generate_social_post(platform, traits):
|
|
| 138 |
)
|
| 139 |
return response.choices[0].message.content
|
| 140 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
# Initialize session state
|
| 142 |
initialize_session()
|
| 143 |
|
|
|
|
| 101 |
traits = ["openness", "conscientiousness", "extraversion", "agreeableness", "neuroticism"]
|
| 102 |
return {trait: float(prob) for trait, prob in zip(traits, probs[0])}
|
| 103 |
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
|
| 107 |
def generate_social_post(platform, traits):
|
| 108 |
"""Generate platform-specific social post"""
|
| 109 |
platform_prompts = {
|
|
|
|
| 125 |
}
|
| 126 |
}
|
| 127 |
|
| 128 |
+
# Define the style for each platform separately
|
| 129 |
+
styles = {
|
|
|
|
| 130 |
'instagram': 'visually appealing with hashtags',
|
| 131 |
'linkedin': 'professional and inspiring',
|
| 132 |
'facebook': 'friendly and engaging',
|
| 133 |
'whatsapp': 'casual and fun'
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
prompt = f"""{platform_prompts[platform]['prompt']}
|
| 137 |
+
Based on these personality traits: {traits}
|
| 138 |
+
Include {platform_prompts[platform]['emoji']} emoji and make it {styles[platform]}"""
|
| 139 |
|
| 140 |
response = groq_client.chat.completions.create(
|
| 141 |
model="mixtral-8x7b-32768",
|
|
|
|
| 144 |
)
|
| 145 |
return response.choices[0].message.content
|
| 146 |
|
| 147 |
+
|
| 148 |
+
|
| 149 |
+
|
| 150 |
+
|
| 151 |
+
|
| 152 |
# Initialize session state
|
| 153 |
initialize_session()
|
| 154 |
|