Organizing
This commit is contained in:
parent
86270d6091
commit
30d34d4346
4 changed files with 5 additions and 74 deletions
|
|
@ -1,11 +1,10 @@
|
|||
from flask import Flask, request, jsonify
|
||||
import joblib # or pickle if you're using that
|
||||
import sklearn # just to ensure compatibility if needed
|
||||
import joblib
|
||||
import sklearn
|
||||
import numpy as np
|
||||
|
||||
# Load your trained model and vectorizer
|
||||
model = joblib.load("model/category_model.pkl")
|
||||
vectorizer = joblib.load("model/vectorizer.pkl") # if used
|
||||
vectorizer = joblib.load("model/vectorizer.pkl")
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,62 +1,4 @@
|
|||
|
||||
/*const express = require("express");
|
||||
const cors = require("cors");
|
||||
const dotenv = require("dotenv");
|
||||
const connectDB = require("../config/db");
|
||||
const http = require("http");
|
||||
const TransRoutes = require("./routes/")
|
||||
dotenv.config();
|
||||
const app = express();
|
||||
const server = http.createServer(app); // Pass `app` to `http.createServer`
|
||||
|
||||
// Connect Database
|
||||
connectDB();
|
||||
// Middleware
|
||||
app.use(express.json());
|
||||
app.use(cors());
|
||||
|
||||
// Routes
|
||||
app.use("/api/transactions", TransRoutes);
|
||||
|
||||
// Start Server
|
||||
const PORT = process.env.PORT || 5000;
|
||||
server.listen(PORT, () => {
|
||||
console.log(`✅ Server running on http://localhost:${PORT}`);
|
||||
});
|
||||
*/
|
||||
/*
|
||||
const express = require('express');
|
||||
const mongoose = require('mongoose');
|
||||
const app = express();
|
||||
app.use(express.json()); // to parse JSON
|
||||
const predictRoute = require('./routes/predict');
|
||||
app.use('/api/predict', predictRoute);
|
||||
mongoose.connect('mongodb://localhost:27017/chat', { useNewUrlParser: true, useUnifiedTopology: true });
|
||||
|
||||
// Define schema and model
|
||||
const transactionSchema = new mongoose.Schema({
|
||||
description: String,
|
||||
amount: Number,
|
||||
date: { type: Date, default: Date.now },
|
||||
});
|
||||
|
||||
const Transaction = mongoose.model('Transaction', transactionSchema);
|
||||
|
||||
// POST endpoint to add transaction
|
||||
app.post('/api/transaction/add', async (req, res) => {
|
||||
try {
|
||||
const newTransaction = new Transaction(req.body);
|
||||
await newTransaction.save();
|
||||
res.status(200).json({ message: 'Transaction saved', data: newTransaction });
|
||||
} catch (err) {
|
||||
res.status(500).json({ error: err.message });
|
||||
}
|
||||
});
|
||||
|
||||
app.listen(3000, () => {
|
||||
console.log('Server running on port 3000');
|
||||
});
|
||||
*/
|
||||
const express = require('express');
|
||||
const mongoose = require('mongoose');
|
||||
const axios = require('axios');
|
||||
|
|
@ -79,7 +21,7 @@ const transactionSchema = new mongoose.Schema({
|
|||
description: String,
|
||||
amount: Number,
|
||||
|
||||
category: String, // 👈 added category
|
||||
category: String,
|
||||
date: { type: Date, default: Date.now },
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -552,7 +552,6 @@ class _FinTrackHomePageState extends State<FinTrackHomePage>
|
|||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Header
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
|
|
@ -561,15 +560,6 @@ class _FinTrackHomePageState extends State<FinTrackHomePage>
|
|||
children: [
|
||||
Text(
|
||||
'Good Morning! 👋',
|
||||
style: GoogleFonts.inter(
|
||||
color: textSecondary,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'Alex Johnson',
|
||||
style: GoogleFonts.inter(
|
||||
color: primaryColor,
|
||||
fontSize: 24,
|
||||
|
|
|
|||
|
|
@ -48,7 +48,6 @@ class StatisticsState extends State<Statistics> with TickerProviderStateMixin {
|
|||
late AnimationController _animationController;
|
||||
late Animation<double> _fadeAnimation;
|
||||
late Animation<Offset> _slideAnimation;
|
||||
var budget = 10000.0;
|
||||
final List<String> categories = [
|
||||
'Food',
|
||||
'Shopping',
|
||||
|
|
@ -304,6 +303,7 @@ class StatisticsState extends State<Statistics> with TickerProviderStateMixin {
|
|||
);
|
||||
}
|
||||
|
||||
var budget = 10000.0 > 0 ? 10000.0 : 0.0;
|
||||
Widget _buildTotalSpentCard() {
|
||||
final totalSpent = transactions.fold<double>(
|
||||
0,
|
||||
|
|
|
|||
Loading…
Reference in a new issue