jojopp commited on
Commit
a2ca67f
·
1 Parent(s): 89f6a28

working agent for blog writting

Browse files
.gradio/certificate.pem ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw
3
+ TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh
4
+ cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4
5
+ WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJu
6
+ ZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBY
7
+ MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54rVygc
8
+ h77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+
9
+ 0TM8ukj13Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6U
10
+ A5/TR5d8mUgjU+g4rk8Kb4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sW
11
+ T8KOEUt+zwvo/7V3LvSye0rgTBIlDHCNAymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyH
12
+ B5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ4Q7e2RCOFvu396j3x+UC
13
+ B5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf1b0SHzUv
14
+ KBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0x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n/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc=
31
+ -----END CERTIFICATE-----
__pycache__/Gradio_UI.cpython-312.pyc ADDED
Binary file (12 kB). View file
 
__pycache__/app.cpython-312.pyc ADDED
Binary file (2.93 kB). View file
 
app.py CHANGED
@@ -4,6 +4,7 @@ import requests
4
  import pytz
5
  import yaml
6
  from tools.final_answer import FinalAnswerTool
 
7
  from Gradio_UI import GradioUI
8
 
9
  @tool
@@ -53,7 +54,11 @@ agent = CodeAgent(
53
  final_answer,
54
  generate_blog_outline,
55
  suggest_blog_topics,
56
- get_current_time_in_timezone
 
 
 
 
57
  ],
58
  max_steps=6,
59
  verbosity_level=1,
 
4
  import pytz
5
  import yaml
6
  from tools.final_answer import FinalAnswerTool
7
+ from tools.blog_tools import generate_blog_section, improve_writing_style, check_readability, generate_seo_metadata
8
  from Gradio_UI import GradioUI
9
 
10
  @tool
 
54
  final_answer,
55
  generate_blog_outline,
56
  suggest_blog_topics,
57
+ get_current_time_in_timezone,
58
+ generate_blog_section,
59
+ improve_writing_style,
60
+ check_readability,
61
+ generate_seo_metadata
62
  ],
63
  max_steps=6,
64
  verbosity_level=1,
requirements.txt CHANGED
@@ -3,3 +3,7 @@ smolagents
3
  requests
4
  duckduckgo_search
5
  pandas
 
 
 
 
 
3
  requests
4
  duckduckgo_search
5
  pandas
6
+ gradio
7
+ pytz
8
+ pyyaml
9
+ transformers
run_blog_agent.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from app import agent
2
+ from Gradio_UI import GradioUI
3
+
4
+ # Create the Gradio interface
5
+ ui = GradioUI(agent)
6
+
7
+ # Launch the interface
8
+ if __name__ == "__main__":
9
+ print("Starting Blog Writing Assistant...")
10
+ print("Access the interface in your web browser...")
11
+ ui.launch(share=True)
tools/__pycache__/blog_tools.cpython-312.pyc ADDED
Binary file (2.52 kB). View file
 
tools/__pycache__/final_answer.cpython-312.pyc ADDED
Binary file (1.02 kB). View file
 
tools/blog_tools.py ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from smolagents import tool
2
+ from typing import List, Dict
3
+ import re
4
+
5
+ @tool
6
+ def generate_blog_section(topic: str, section_title: str) -> str:
7
+ """Generates content for a specific section of the blog post
8
+ Args:
9
+ topic: The main topic of the blog post
10
+ section_title: The title of the section to generate
11
+ """
12
+ return f"Generated content for section '{section_title}' about {topic}"
13
+
14
+ @tool
15
+ def improve_writing_style(text: str, style: str = "professional") -> str:
16
+ """Improves the writing style of the given text
17
+ Args:
18
+ text: The text to improve
19
+ style: The desired writing style (e.g., professional, casual, academic)
20
+ """
21
+ return f"Improved version of the text in {style} style"
22
+
23
+ @tool
24
+ def check_readability(text: str) -> Dict:
25
+ """Analyzes the readability of the text
26
+ Args:
27
+ text: The text to analyze
28
+ """
29
+ # Simple implementation - you can make this more sophisticated
30
+ words = len(text.split())
31
+ sentences = len(re.split(r'[.!?]+', text))
32
+ avg_words_per_sentence = words / max(sentences, 1)
33
+
34
+ return {
35
+ "word_count": words,
36
+ "sentence_count": sentences,
37
+ "avg_words_per_sentence": avg_words_per_sentence,
38
+ "readability_score": "Good" if avg_words_per_sentence < 20 else "Complex"
39
+ }
40
+
41
+ @tool
42
+ def generate_seo_metadata(title: str, content: str) -> Dict:
43
+ """Generates SEO metadata for the blog post
44
+ Args:
45
+ title: The blog post title
46
+ content: The blog post content
47
+ """
48
+ return {
49
+ "meta_description": f"An informative article about {title}",
50
+ "keywords": [word.lower() for word in title.split()],
51
+ "suggested_title_tags": [f"<h1>{title}</h1>"]
52
+ }
tools/final_answer.py CHANGED
@@ -2,7 +2,7 @@ from typing import Any, Optional
2
  from smolagents.tools import Tool
3
 
4
  class FinalAnswerTool(Tool):
5
- name = "final_answer it is"
6
  description = "Provides a final answer to the given problem."
7
  inputs = {'answer': {'type': 'any', 'description': 'The final answer to the problem'}}
8
  output_type = "any"
 
2
  from smolagents.tools import Tool
3
 
4
  class FinalAnswerTool(Tool):
5
+ name = "final_answer"
6
  description = "Provides a final answer to the given problem."
7
  inputs = {'answer': {'type': 'any', 'description': 'The final answer to the problem'}}
8
  output_type = "any"