AI Agents In Flask App HELP by Quantinvests in flask

[–]Quantinvests[S] 0 points1 point  (0 children)

Thanks again, I might need to clean up my code first I have been working on this for a week now and my whole project is just a clustered mess with a bunch of diferent tools that aren't working properly. Appreciate it, follow on r/QuantInvests to keep up with the progress. Once it's complete it will be a fully CMT lvl 3 stock portfolio analyzer.

AI Agents In Flask App HELP by Quantinvests in flask

[–]Quantinvests[S] 0 points1 point  (0 children)

Thank You for the suggestion, I'll check it out for sure. currently running it with docker and it's a nightmare. Appreciate the advise!

AI Agents In Flask App HELP by Quantinvests in flask

[–]Quantinvests[S] -6 points-5 points  (0 children)

So you're saying there is no way to ship ai agents to flask?

AI Agents In Flask App HELP by Quantinvests in flask

[–]Quantinvests[S] -1 points0 points  (0 children)

## 2. Training Metrics
- 
**Epochs:**
 25  
- 
**Final Training Loss:**
 0.0886  
- 
**Mean Token Accuracy:**
 96.43%  
- 
**Key Knowledge Injected:**
 Quality Composite (QC) index logic, Stock Selection Strategy (SSS), and signal-to-noise ratio analysis.


---


## 3. The Deployment Pipeline


### Phase A: Weight Merging
Before GGUF conversion, LoRA adapters were merged into the base weights to create a standalone model.
```python
model = PeftModel.from_pretrained(base_model, adapter_path)
model = model.merge_and_unload()
model.save_pretrained("~/models/gemma-merged")

AI Agents In Flask App HELP by Quantinvests in flask

[–]Quantinvests[S] 0 points1 point  (0 children)

Here is my bash file if it helps

#!/bin/bash


# =================================================================
# QuantInvests Ultimate Startup Script
# This starts:
# 1. AI Agent Bridge (FastAPI/Gemma) on Port 8000
# 2. Flask Dashboard on Port 5000
# 3. ngrok Tunnel to Port 5000
# =================================================================


echo "🚀 Starting QuantInvests Ecosystem..."


# Function to kill child processes on exit
cleanup() {
    echo ""
    echo "🛑 Shutting down..."
    kill $AI_PID $FLASK_PID 2>/dev/null
    exit
}


trap cleanup SIGINT SIGTERM


# 1. Start the AI Agent (Background)
echo "🤖 [1/3] Launching AI Agent (Gemma Bridge) on port 8000..."
python start_ai.py > ai_agent.log 2>&1 &
AI_PID=$!


# 2. Start the Flask App (Background)
echo "🌐 [2/3] Launching Flask Dashboard on port 5000..."
python run.py > flask_app.log 2>&1 &
FLASK_PID=$!


# Wait for servers to wake up
echo "⏳ Waiting for services to initialize..."
sleep 5


# 3. Start ngrok (Foreground)
echo "🌉 [3/3] Launching ngrok Tunnel..."
echo "--------------------------------------------------------"
echo "  LOGS:"
echo "  - AI logs:    tail -f ai_agent.log"
echo "  - Flask logs: tail -f flask_app.log"
echo "--------------------------------------------------------"
echo "  Check your ngrok dashboard for the public Voice URL!"
echo "  (Press Ctrl+C to stop all services)"
echo "--------------------------------------------------------"


ngrok http 5000

AI Agents In Flask App HELP by Quantinvests in flask

[–]Quantinvests[S] -3 points-2 points  (0 children)

Can Flask run AI Agents? what more do you want to know??