Spaces:
Sleeping
Sleeping
update tools
Browse files
app.py
CHANGED
|
@@ -35,20 +35,25 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
| 35 |
|
| 36 |
@tool
|
| 37 |
def generate_post(subject: str, max_length: int = 200) -> str:
|
| 38 |
-
"""Generates a well-structured post about a given subject
|
| 39 |
|
| 40 |
Args:
|
| 41 |
subject: The topic to generate a post about.
|
| 42 |
max_length: The maximum length of the post in characters (default: 200).
|
| 43 |
|
| 44 |
Returns:
|
| 45 |
-
A
|
| 46 |
"""
|
| 47 |
-
prompt = f"Write a concise and engaging social media post about {subject}.
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
|
| 54 |
final_answer = FinalAnswerTool()
|
|
|
|
| 35 |
|
| 36 |
@tool
|
| 37 |
def generate_post(subject: str, max_length: int = 200) -> str:
|
| 38 |
+
"""Generates a concise and well-structured post about a given subject.
|
| 39 |
|
| 40 |
Args:
|
| 41 |
subject: The topic to generate a post about.
|
| 42 |
max_length: The maximum length of the post in characters (default: 200).
|
| 43 |
|
| 44 |
Returns:
|
| 45 |
+
A well-structured, engaging post about the subject.
|
| 46 |
"""
|
| 47 |
+
prompt = f"Write a concise and engaging social media post about {subject}. Limit the response to {max_length} characters."
|
| 48 |
+
|
| 49 |
+
try:
|
| 50 |
+
global model
|
| 51 |
+
response = model.generate_text(prompt)
|
| 52 |
+
|
| 53 |
+
return response[:max_length]
|
| 54 |
+
except Exception as e:
|
| 55 |
+
return f"Error generating post: {str(e)}"
|
| 56 |
+
|
| 57 |
|
| 58 |
|
| 59 |
final_answer = FinalAnswerTool()
|