| 1 | { |
| 2 | "cells": [ |
| 3 | { |
| 4 | "cell_type": "markdown", |
| 5 | "metadata": {}, |
| 6 | "source": [ |
| 7 | "# MoneyPrinterTurbo Setup Guide\n", |
| 8 | "\n", |
| 9 | "This notebook will guide you through the process of setting up [MoneyPrinterTurbo](https://github.com/harry0703/MoneyPrinterTurbo)." |
| 10 | ] |
| 11 | }, |
| 12 | { |
| 13 | "cell_type": "markdown", |
| 14 | "metadata": {}, |
| 15 | "source": [ |
| 16 | "## 1. Clone Repository and Install Dependencies\n", |
| 17 | "\n", |
| 18 | "First, we'll clone the repository from GitHub and install all required packages:" |
| 19 | ] |
| 20 | }, |
| 21 | { |
| 22 | "cell_type": "code", |
| 23 | "execution_count": null, |
| 24 | "metadata": { |
| 25 | "id": "S8Eu-aQarY_B" |
| 26 | }, |
| 27 | "outputs": [], |
| 28 | "source": [ |
| 29 | "!git clone https://github.com/harry0703/MoneyPrinterTurbo.git\n", |
| 30 | "%cd MoneyPrinterTurbo\n", |
| 31 | "!pip install -q uv pyngrok\n", |
| 32 | "!uv python install 3.11\n", |
| 33 | "# Colab 预装了 google-colab / google-genai / google-adk 等包,直接 pip install -r requirements.txt\n", |
| 34 | "# 会覆盖全局依赖并触发版本冲突。这里使用 uv 为项目创建独立 .venv,避免影响 Colab 运行时。\n", |
| 35 | "!uv sync --frozen --python 3.11" |
| 36 | ] |
| 37 | }, |
| 38 | { |
| 39 | "cell_type": "markdown", |
| 40 | "metadata": {}, |
| 41 | "source": [ |
| 42 | "## 2. Configure ngrok for Remote Access\n", |
| 43 | "\n", |
| 44 | "We'll use ngrok to create a secure tunnel to expose our local Streamlit server to the internet.\n", |
| 45 | "\n", |
| 46 | "**Important**: You need to get your authentication token from the [ngrok dashboard](https://dashboard.ngrok.com/get-started/your-authtoken) to use this service." |
| 47 | ] |
| 48 | }, |
| 49 | { |
| 50 | "cell_type": "code", |
| 51 | "execution_count": null, |
| 52 | "metadata": {}, |
| 53 | "outputs": [], |
| 54 | "source": [ |
| 55 | "from pyngrok import ngrok\n", |
| 56 | "\n", |
| 57 | "# Terminate any existing ngrok tunnels\n", |
| 58 | "ngrok.kill()\n", |
| 59 | "\n", |
| 60 | "# Set your authentication token\n", |
| 61 | "# Replace \"your_ngrok_auth_token\" with your actual token\n", |
| 62 | "ngrok.set_auth_token(\"your_ngrok_auth_token\")" |
| 63 | ] |
| 64 | }, |
| 65 | { |
| 66 | "cell_type": "markdown", |
| 67 | "metadata": {}, |
| 68 | "source": [ |
| 69 | "## 3. Launch Application and Generate Public URL\n", |
| 70 | "\n", |
| 71 | "Now we'll start the Streamlit server and create an ngrok tunnel to make it accessible online:" |
| 72 | ] |
| 73 | }, |
| 74 | { |
| 75 | "cell_type": "code", |
| 76 | "execution_count": null, |
| 77 | "metadata": { |
| 78 | "colab": { |
| 79 | "base_uri": "https://localhost:8080/" |
| 80 | }, |
| 81 | "collapsed": true, |
| 82 | "id": "oahsIOXmwjl9", |
| 83 | "outputId": "ee23a96c-af21-4207-deb7-9fab69e0c05e" |
| 84 | }, |
| 85 | "outputs": [], |
| 86 | "source": [ |
| 87 | "import subprocess\n", |
| 88 | "import time\n", |
| 89 | "\n", |
| 90 | "print(\"🚀 Starting MoneyPrinterTurbo...\")\n", |
| 91 | "# 通过 uv run 进入项目 .venv,确保 Streamlit 使用上一步锁定的依赖版本。\n", |
| 92 | "streamlit_proc = subprocess.Popen([\n", |
| 93 | " \"uv\", \"run\", \"streamlit\", \"run\", \"./webui/Main.py\", \"--server.port=8501\", \"--server.address=0.0.0.0\"\n", |
| 94 | "])\n", |
| 95 | "\n", |
| 96 | "# Wait for the server to initialize\n", |
| 97 | "time.sleep(5)\n", |
| 98 | "\n", |
| 99 | "print(\"🌐 Creating ngrok tunnel to expose the MoneyPrinterTurbo...\")\n", |
| 100 | "public_url = ngrok.connect(8501, bind_tls=True)\n", |
| 101 | "\n", |
| 102 | "print(\"✅ Deployment complete! Access your MoneyPrinterTurbo at:\")\n", |
| 103 | "print(public_url)" |
| 104 | ] |
| 105 | } |
| 106 | ], |
| 107 | "metadata": { |
| 108 | "colab": { |
| 109 | "provenance": [] |
| 110 | }, |
| 111 | "kernelspec": { |
| 112 | "display_name": "Python 3", |
| 113 | "name": "python3" |
| 114 | }, |
| 115 | "language_info": { |
| 116 | "name": "python" |
| 117 | } |
| 118 | }, |
| 119 | "nbformat": 4, |
| 120 | "nbformat_minor": 0 |
| 121 | } |
| 122 |