Files
MoneyPrinterTurbo/docs/MoneyPrinterTurbo.ipynb
2026-06-12 14:59:20 +08:00

122 lines
3.7 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# MoneyPrinterTurbo Setup Guide\n",
"\n",
"This notebook will guide you through the process of setting up [MoneyPrinterTurbo](https://github.com/harry0703/MoneyPrinterTurbo)."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 1. Clone Repository and Install Dependencies\n",
"\n",
"First, we'll clone the repository from GitHub and install all required packages:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "S8Eu-aQarY_B"
},
"outputs": [],
"source": [
"!git clone https://github.com/harry0703/MoneyPrinterTurbo.git\n",
"%cd MoneyPrinterTurbo\n",
"!pip install -q uv pyngrok\n",
"!uv python install 3.11\n",
"# Colab 预装了 google-colab / google-genai / google-adk 等包,直接 pip install -r requirements.txt\n",
"# 会覆盖全局依赖并触发版本冲突。这里使用 uv 为项目创建独立 .venv避免影响 Colab 运行时。\n",
"!uv sync --frozen --python 3.11"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 2. Configure ngrok for Remote Access\n",
"\n",
"We'll use ngrok to create a secure tunnel to expose our local Streamlit server to the internet.\n",
"\n",
"**Important**: You need to get your authentication token from the [ngrok dashboard](https://dashboard.ngrok.com/get-started/your-authtoken) to use this service."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from pyngrok import ngrok\n",
"\n",
"# Terminate any existing ngrok tunnels\n",
"ngrok.kill()\n",
"\n",
"# Set your authentication token\n",
"# Replace \"your_ngrok_auth_token\" with your actual token\n",
"ngrok.set_auth_token(\"your_ngrok_auth_token\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 3. Launch Application and Generate Public URL\n",
"\n",
"Now we'll start the Streamlit server and create an ngrok tunnel to make it accessible online:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"collapsed": true,
"id": "oahsIOXmwjl9",
"outputId": "ee23a96c-af21-4207-deb7-9fab69e0c05e"
},
"outputs": [],
"source": [
"import subprocess\n",
"import time\n",
"\n",
"print(\"🚀 Starting MoneyPrinterTurbo...\")\n",
"# 通过 uv run 进入项目 .venv确保 Streamlit 使用上一步锁定的依赖版本。\n",
"streamlit_proc = subprocess.Popen([\n",
" \"uv\", \"run\", \"streamlit\", \"run\", \"./webui/Main.py\", \"--server.port=8501\", \"--server.address=0.0.0.0\"\n",
"])\n",
"\n",
"# Wait for the server to initialize\n",
"time.sleep(5)\n",
"\n",
"print(\"🌐 Creating ngrok tunnel to expose the MoneyPrinterTurbo...\")\n",
"public_url = ngrok.connect(8501, bind_tls=True)\n",
"\n",
"print(\"✅ Deployment complete! Access your MoneyPrinterTurbo at:\")\n",
"print(public_url)"
]
}
],
"metadata": {
"colab": {
"provenance": []
},
"kernelspec": {
"display_name": "Python 3",
"name": "python3"
},
"language_info": {
"name": "python"
}
},
"nbformat": 4,
"nbformat_minor": 0
}