File size: 1,705 Bytes
f7e20e1
 
 
1aea387
 
f7e20e1
 
 
dcd32d5
f7e20e1
7a7ede6
f7e20e1
fdff020
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
---
title: Stock Forecast App
emoji: πŸ“ˆ
colorFrom: indigo
colorTo: indigo
sdk: docker
pinned: false
license: mit
short_description: Stock Prediction using Flask framework
---

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference

# 🧠 Stock Price Predictor β€” Flask + Random Forest

A machine learning web app built using Flask and deployed on Hugging Face Spaces with Docker.  
It predicts future stock prices using historical Yahoo Finance data and Random Forest regression.

---

## πŸš€ Tech Stack
- **Flask** β€” Web framework to build the backend logic and user interface.
- **Gunicorn** β€” WSGI production server for running Flask apps.
- **YFinance** β€” Fetches live and historical stock data.
- **Scikit-learn** β€” Implements the Random Forest prediction model.
- **Pandas & NumPy** β€” For data manipulation and mathematical operations.

---

## βš™οΈ Features
βœ… Fetch 5 years of stock data from Yahoo Finance  
βœ… Compute indicators (RSI, MACD, Moving Averages)  
βœ… Predict next 30-day prices using Random Forest  
βœ… Detect trend (Bullish / Bearish / Sideways)  
βœ… Suggest entry and stop-loss points  
βœ… Display detailed report and 30-day recent table  

---

## 🐳 Deployment on Hugging Face
This Space uses **Docker runtime**.

### Files used:
- `Dockerfile` β€” Defines the container environment
- `requirements.txt` β€” Lists Python dependencies
- `app.py` β€” Contains Flask application logic

To deploy:
1. Create a new **Hugging Face Space**.
2. Choose **Docker** as the SDK.
3. Upload `app.py`, `requirements.txt`, and `Dockerfile`.
4. Click **Deploy Space** β€” your Flask app will run automatically on port **7860**.