Muhammad Abdur Rahman Saad commited on
Commit
ee9af6d
1 Parent(s): 5f8829d

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +96 -1
README.md CHANGED
@@ -7,4 +7,99 @@ sdk: docker
7
  pinned: false
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  pinned: false
8
  ---
9
 
10
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
11
+
12
+ The AI News Agent is a Flask application deployed on Hugging Face Spaces via Docker. This application provides multiple endpoints that allow users to search, query, and analyze news articles based on various parameters such as keywords, tone, and policy changes.
13
+
14
+ ## Endpoints
15
+
16
+ ### `/search`
17
+
18
+ **Purpose**: Search for articles based on category and title keywords.
19
+
20
+ **Request Example**:
21
+ ```json
22
+ POST /search
23
+ Content-Type: application/json
24
+
25
+ {
26
+ "titles": ["economy", "finance"],
27
+ "categories": ["business", "technology"]
28
+ }
29
+ ```
30
+
31
+ ### `/query`
32
+
33
+ **Purpose**: Retrieve detailed responses to queries about specific articles identified by article IDs.
34
+
35
+ **Request Example**:
36
+ ```json
37
+ POST /query
38
+ Content-Type: application/json
39
+
40
+ {
41
+ "ids": ["article1_id", "article2_id"],
42
+ "query": "What is the impact of the new economic policy?"
43
+ }
44
+ ```
45
+
46
+ ### `/tone`
47
+
48
+ **Purpose**: Compare the tone between two articles.
49
+
50
+ **Request Example**:
51
+ ```json
52
+ POST /tone
53
+ Content-Type: application/json
54
+
55
+ {
56
+ "source": "internal or external",
57
+ "article1": "article1_id or article1 content",
58
+ "article2": "article2_id or article2 content"
59
+ }
60
+ ```
61
+
62
+ ### `/compare`
63
+
64
+ **Purpose**: Compare policy changes between two articles.
65
+
66
+ **Request Example**:
67
+ ```json
68
+ POST /tone
69
+ Content-Type: application/json
70
+
71
+ {
72
+ "source": "internal or external",
73
+ "article1": "article1_id or article1 content",
74
+ "article2": "article2_id or article2 content"
75
+ }
76
+ ```
77
+
78
+ ### `/keyword`
79
+
80
+ **Purpose**: Count how many times a specific keyword appears in two different articles.
81
+
82
+ **Request Example**:
83
+ ```json
84
+ POST /tone
85
+ Content-Type: application/json
86
+
87
+ {
88
+ "source": "internal or external",
89
+ "keyword": "keyword to search",
90
+ "article1": "article1_id or article1 content",
91
+ "article2": "article2_id or article2 content"
92
+ }
93
+ ```
94
+
95
+ ## Structure
96
+
97
+ - **`/routes`**: Contains `main.py` which configures the routes for the Flask application.
98
+ - **`/controllers`**:
99
+ - `article_search_service.py`: Functions to search for articles in the database.
100
+ - `article_query_service.py`: Functions to query an LLM for information about articles.
101
+ - `article_comparison_service.py`: Functions to compare tone, policy, and count keywords in articles.
102
+
103
+ ## Deployment
104
+
105
+ This application is deployed on [Hugging Face Spaces](https://huggingface.co/spaces/Oxbridge-Economics/AI-News-Agent?logs=container). The deployment process is managed through Docker, configured in the Dockerfile within this repository, and automated by GitHub Actions.