jomasego commited on
Commit
9336a85
Β·
verified Β·
1 Parent(s): 5df66b9

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +32 -154
README.md CHANGED
@@ -1,170 +1,48 @@
1
- # 🌍 International Trade Flow Predictor with AI Assistant πŸš’πŸ“ˆπŸ€–
2
-
3
- [![Deploy to Hugging Face Spaces](https://github.com/jomasego/international_trade_predictions/actions/workflows/deploy-space.yml/badge.svg)](https://github.com/jomasego/international_trade_predictions/actions/workflows/deploy-space.yml)
4
-
5
- Welcome to the **International Trade Flow Predictor**! πŸŽ‰
6
-
7
- A fun, interactive web app to explore, analyze, and predict international trade flows using real data and machine learning. Now with AI-powered trade assistance! Built with Flask, vanilla JS, and a dash of data science magic. πŸ§™β€β™‚οΈβœ¨
8
-
9
- [![Hugging Face Space](https://img.shields.io/badge/πŸ€—-Hugging%20Face%20Space-cyan.svg)](https://huggingface.co/spaces/jomasego/ai-trade-assistant)
10
-
11
  ---
12
-
13
- ## πŸš€ Features
14
-
15
- - **Tabbed UI Navigation** πŸ—‚οΈ
16
- - Basics: Quick trade lookups
17
- - Exports/Imports by Country 🌎
18
- - Exports/Imports by Product πŸ“¦
19
- - Rankings πŸ†
20
- - Bilateral Trade ↔️
21
- - Data Download πŸ’Ύ
22
- - ML Prediction πŸ€–
23
-
24
- - **Data Visualizations** πŸ“Š
25
- - Tables, charts, and downloadable CSVs everywhere!
26
- - Interactive country/product selection
27
- - All powered by UN COMTRADE, WTO, and World Bank data
28
-
29
- - **Machine Learning Models** 🧠
30
- - Linear Regression
31
- - XGBoost
32
- - LSTM (Deep Learning)
33
- - Predict future trade flows and visualize both historical and predicted values!
34
-
35
- - **Modern, Accessible UI**
36
- - Keyboard navigation, ARIA attributes, and a clean look
37
- - No frontend frameworks, just pure JS!
38
-
39
- - **AI Trade Assistant** πŸ€–
40
- - Powered by Google Gemma-2b
41
- - Interactive chat interface for trade data queries
42
- - HS code explanation and interpretation
43
- - Trade pattern recommendations
44
- - Context-aware responses to help navigate the application
45
-
46
  ---
47
 
48
- ## πŸ› οΈ Deployment Options
49
-
50
- You have two options for deploying this application:
51
-
52
- ### Option 1: Full Web Application with Integrated AI Assistant
53
-
54
- This option gives you the complete Trade Flow Predictor application with the AI Assistant directly integrated into the application interface.
55
-
56
- 1. **Clone the repo:**
57
- ```bash
58
- git clone https://github.com/jomasego/international_trade_predictions.git
59
- cd international_trade_predictions/comtrade_predictions
60
- ```
61
-
62
- 2. **Set up environment variable:**
63
- Create a `.env` file in the root directory with your Hugging Face API token:
64
- ```
65
- HUGGINGFACE_API_TOKEN=your_token_here
66
- ```
67
- This token is required to access the Google Gemma-2b model via Hugging Face Inference API.
68
-
69
- 3. **Install dependencies:**
70
- ```bash
71
- pip install -r requirements.txt
72
- ```
73
-
74
- 4. **Launch the app:**
75
- ```bash
76
- python app.py
77
- ```
78
-
79
- 5. **Open your browser:**
80
- - Go to [http://127.0.0.1:5000](http://127.0.0.1:5000)
81
- - Navigate to the AI Assistant tab to interact with the integrated assistant
82
 
83
- ### Option 2: Standalone AI Trade Assistant on Hugging Face Space
84
-
85
- This option deploys just the AI Assistant component as a separate application on Hugging Face Spaces. This is useful if you only want to provide the AI Assistant functionality without the full application.
86
-
87
- 1. **Use our existing space:**
88
- - Visit [AI Trade Assistant](https://huggingface.co/spaces/jomasego/ai-trade-assistant) to use the pre-deployed version
89
-
90
- 2. **OR deploy your own space:**
91
-
92
- a. **Create a new Space** on Hugging Face with the Flask SDK
93
-
94
- b. **Upload the files from the `clean-space` directory:**
95
- - `app.py`
96
- - `requirements.txt`
97
- - `templates/index.html`
98
-
99
- c. **Set up environment variable:**
100
- - Add `HUGGINGFACE_API_TOKEN` to your space under Settings > Repository Secrets
101
-
102
- d. **Your space will automatically deploy** and be accessible through the provided URL
103
-
104
- ### Option 3: Automatic GitHub Actions Deployment
105
-
106
- This project is configured to automatically deploy to Hugging Face Spaces using GitHub Actions:
107
-
108
- 1. **One-time setup:**
109
- - Add required secrets to your GitHub repository:
110
- - `HF_TOKEN`: Your Hugging Face API token
111
- - `SPACE_NAME`: Your desired Space name
112
- - `HUGGINGFACE_API_TOKEN`: Same as your HF_TOKEN
113
-
114
- 2. **Automatic deployment:**
115
- - Every push to the `main` branch triggers a deployment
116
- - Your app will be available at: `https://huggingface.co/spaces/jomasego/[SPACE_NAME]`
117
-
118
- 3. **Manual triggering:**
119
- - You can also manually trigger deployment from the GitHub Actions tab
120
-
121
- ### Using the AI Assistant
122
-
123
- Regardless of which deployment option you choose:
124
 
125
- 1. Navigate to the AI Assistant interface
126
- 2. Type your trade-related question in the chat input
127
- 3. Use specialized features:
128
- - HS Code Lookup: Get detailed explanations of HS codes
129
- - Trade Recommendations: Receive insights on trade patterns based on countries or product categories
130
 
131
- ---
132
 
133
- ## πŸ” Explore the Tabs
 
 
 
134
 
135
- - **Basics:**
136
- - Quick lookups by country, year, commodity, and flow
137
- - **Exports/Imports by Country:**
138
- - See trade values for all countries in a given year/commodity
139
- - **Exports/Imports by Product:**
140
- - Explore top traded products for a country
141
- - **Rankings:**
142
- - Who are the top exporters/importers? Find out!
143
- - **Bilateral Trade:**
144
- - Analyze trade between any two countries
145
- - **Data Download:**
146
- - Custom CSV downloads for power users
147
- - **Prediction (ML):**
148
- - Select countries, commodity, and year, pick a model, and predict the future! See both historical and predicted values plotted together.
149
 
150
- ---
151
 
152
- ## ⚑ Tech Stack
153
- - Python 3
154
- - Flask
155
- - Pandas, scikit-learn, XGBoost, Keras/TensorFlow
156
- - HTML5, CSS3, JavaScript (vanilla!)
157
 
158
- ---
159
 
160
- ## 🀝 Contributing
161
- PRs welcome! Open an issue, fork, or just say hi. 😊
 
 
162
 
163
- ---
164
 
165
- ## πŸ“¬ Contact
166
- - [GitHub Issues](https://github.com/jomasego/international_trade_predictions/issues)
167
 
168
- ---
169
 
170
- Enjoy exploring the world of trade! πŸŒπŸš€
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ title: Trade Flow Predictor
3
+ emoji: 🌐
4
+ colorFrom: blue
5
+ colorTo: green
6
+ sdk: docker
7
+ sdk_version: "1.0"
8
+ app_file: app.py
9
+ pinned: false
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  ---
11
 
12
+ # International Trade Flow Predictor with AI Assistant
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
+ Welcome to the **International Trade Flow Predictor**! πŸŽ‰
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
+ A fun, interactive web app to explore, analyze, and predict international trade flows using real data and machine learning. Now with AI-powered trade assistance! Built with Flask, vanilla JS, and a dash of data science magic.
 
 
 
 
17
 
18
+ ## Features
19
 
20
+ - **Interactive Data Visualization**: Explore international trade data with various chart types and filters
21
+ - **Machine Learning Predictions**: Forecast future trade values using multiple ML models
22
+ - **AI Trade Assistant**: Get intelligent assistance with all your trade-related questions
23
+ - **Comprehensive Data Access**: Retrieve and analyze data from UN COMTRADE, WTO, and World Bank sources
24
 
25
+ ## AI Assistant Capabilities
 
 
 
 
 
 
 
 
 
 
 
 
 
26
 
27
+ The built-in AI Trade Assistant, powered by Google Gemma-2b via Hugging Face, can help you:
28
 
29
+ - Understand trade terminology and HS codes
30
+ - Explore interesting trade patterns
31
+ - Find specific trade data
32
+ - Interpret visualization results
33
+ - Provide insights about international trade
34
 
35
+ ## Using the Application
36
 
37
+ 1. Explore different tabs to access various features
38
+ 2. Select countries, products, and years to visualize data
39
+ 3. Try the machine learning predictions for future trade values
40
+ 4. Chat with the AI Assistant for trade-related questions
41
 
42
+ ## Privacy & Data Usage
43
 
44
+ This application does not collect any personal data. API usage is subject to fair use policies of the data sources (UN COMTRADE, WTO, World Bank).
 
45
 
46
+ ## About
47
 
48
+ Created by JosΓ© MarΓ­a SeguΓ­ GΓ³mez-Olea. The AI component is powered by Google Gemma-2b through Hugging Face Inference API.