Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
dickreuter committed Oct 2, 2023
1 parent c471c15 commit 77b9a69
Show file tree
Hide file tree
Showing 15 changed files with 209 additions and 165 deletions.
69 changes: 19 additions & 50 deletions notebooks/yolotrainer.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,61 +9,30 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Collecting roboflow\n",
" Downloading roboflow-1.0.9-py3-none-any.whl (56 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m56.3/56.3 kB\u001b[0m \u001b[31m2.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hRequirement already satisfied: kiwisolver>=1.3.1 in /Users/dickr/opt/anaconda3/envs/poker310/lib/python3.10/site-packages (from roboflow) (1.4.4)\n",
"Collecting pyparsing==2.4.7\n",
" Downloading pyparsing-2.4.7-py2.py3-none-any.whl (67 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m67.8/67.8 kB\u001b[0m \u001b[31m5.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hRequirement already satisfied: tqdm>=4.41.0 in /Users/dickr/opt/anaconda3/envs/poker310/lib/python3.10/site-packages (from roboflow) (4.65.0)\n",
"Collecting idna==2.10\n",
" Using cached idna-2.10-py2.py3-none-any.whl (58 kB)\n",
"Requirement already satisfied: opencv-python>=4.1.2 in /Users/dickr/opt/anaconda3/envs/poker310/lib/python3.10/site-packages (from roboflow) (4.7.0.72)\n",
"Collecting chardet==4.0.0\n",
" Using cached chardet-4.0.0-py2.py3-none-any.whl (178 kB)\n",
"Collecting cycler==0.10.0\n",
" Downloading cycler-0.10.0-py2.py3-none-any.whl (6.5 kB)\n",
"Collecting wget\n",
" Downloading wget-3.2.zip (10 kB)\n",
" Preparing metadata (setup.py) ... \u001b[?25ldone\n",
"\u001b[?25hRequirement already satisfied: numpy>=1.18.5 in /Users/dickr/opt/anaconda3/envs/poker310/lib/python3.10/site-packages (from roboflow) (1.24.2)\n",
"Collecting python-dotenv\n",
" Using cached python_dotenv-1.0.0-py3-none-any.whl (19 kB)\n",
"Requirement already satisfied: urllib3>=1.26.6 in /Users/dickr/opt/anaconda3/envs/poker310/lib/python3.10/site-packages (from roboflow) (1.26.15)\n",
"Requirement already satisfied: six in /Users/dickr/opt/anaconda3/envs/poker310/lib/python3.10/site-packages (from roboflow) (1.15.0)\n",
"Collecting requests-toolbelt\n",
" Downloading requests_toolbelt-1.0.0-py2.py3-none-any.whl (54 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m54.5/54.5 kB\u001b[0m \u001b[31m5.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hRequirement already satisfied: requests in /Users/dickr/opt/anaconda3/envs/poker310/lib/python3.10/site-packages (from roboflow) (2.28.2)\n",
"Requirement already satisfied: certifi==2022.12.7 in /Users/dickr/opt/anaconda3/envs/poker310/lib/python3.10/site-packages (from roboflow) (2022.12.7)\n",
"Requirement already satisfied: roboflow in /Users/dickr/opt/anaconda3/envs/poker310/lib/python3.10/site-packages (1.0.9)\n",
"Requirement already satisfied: python-dateutil in /Users/dickr/opt/anaconda3/envs/poker310/lib/python3.10/site-packages (from roboflow) (2.8.2)\n",
"Requirement already satisfied: chardet==4.0.0 in /Users/dickr/opt/anaconda3/envs/poker310/lib/python3.10/site-packages (from roboflow) (4.0.0)\n",
"Requirement already satisfied: numpy>=1.18.5 in /Users/dickr/opt/anaconda3/envs/poker310/lib/python3.10/site-packages (from roboflow) (1.24.2)\n",
"Requirement already satisfied: requests-toolbelt in /Users/dickr/opt/anaconda3/envs/poker310/lib/python3.10/site-packages (from roboflow) (1.0.0)\n",
"Requirement already satisfied: PyYAML>=5.3.1 in /Users/dickr/opt/anaconda3/envs/poker310/lib/python3.10/site-packages (from roboflow) (6.0)\n",
"Requirement already satisfied: opencv-python>=4.1.2 in /Users/dickr/opt/anaconda3/envs/poker310/lib/python3.10/site-packages (from roboflow) (4.7.0.72)\n",
"Requirement already satisfied: pyparsing==2.4.7 in /Users/dickr/opt/anaconda3/envs/poker310/lib/python3.10/site-packages (from roboflow) (2.4.7)\n",
"Requirement already satisfied: requests in /Users/dickr/opt/anaconda3/envs/poker310/lib/python3.10/site-packages (from roboflow) (2.28.2)\n",
"Requirement already satisfied: Pillow>=7.1.2 in /Users/dickr/opt/anaconda3/envs/poker310/lib/python3.10/site-packages (from roboflow) (9.4.0)\n",
"Requirement already satisfied: six in /Users/dickr/opt/anaconda3/envs/poker310/lib/python3.10/site-packages (from roboflow) (1.15.0)\n",
"Requirement already satisfied: idna==2.10 in /Users/dickr/opt/anaconda3/envs/poker310/lib/python3.10/site-packages (from roboflow) (2.10)\n",
"Requirement already satisfied: cycler==0.10.0 in /Users/dickr/opt/anaconda3/envs/poker310/lib/python3.10/site-packages (from roboflow) (0.10.0)\n",
"Requirement already satisfied: certifi==2022.12.7 in /Users/dickr/opt/anaconda3/envs/poker310/lib/python3.10/site-packages (from roboflow) (2022.12.7)\n",
"Requirement already satisfied: wget in /Users/dickr/opt/anaconda3/envs/poker310/lib/python3.10/site-packages (from roboflow) (3.2)\n",
"Requirement already satisfied: python-dotenv in /Users/dickr/opt/anaconda3/envs/poker310/lib/python3.10/site-packages (from roboflow) (1.0.0)\n",
"Requirement already satisfied: tqdm>=4.41.0 in /Users/dickr/opt/anaconda3/envs/poker310/lib/python3.10/site-packages (from roboflow) (4.65.0)\n",
"Requirement already satisfied: matplotlib in /Users/dickr/opt/anaconda3/envs/poker310/lib/python3.10/site-packages (from roboflow) (3.7.1)\n",
"Requirement already satisfied: urllib3>=1.26.6 in /Users/dickr/opt/anaconda3/envs/poker310/lib/python3.10/site-packages (from roboflow) (1.26.15)\n",
"Requirement already satisfied: kiwisolver>=1.3.1 in /Users/dickr/opt/anaconda3/envs/poker310/lib/python3.10/site-packages (from roboflow) (1.4.4)\n",
"Requirement already satisfied: contourpy>=1.0.1 in /Users/dickr/opt/anaconda3/envs/poker310/lib/python3.10/site-packages (from matplotlib->roboflow) (1.0.7)\n",
"Requirement already satisfied: fonttools>=4.22.0 in /Users/dickr/opt/anaconda3/envs/poker310/lib/python3.10/site-packages (from matplotlib->roboflow) (4.39.0)\n",
"Requirement already satisfied: packaging>=20.0 in /Users/dickr/opt/anaconda3/envs/poker310/lib/python3.10/site-packages (from matplotlib->roboflow) (23.0)\n",
"Requirement already satisfied: contourpy>=1.0.1 in /Users/dickr/opt/anaconda3/envs/poker310/lib/python3.10/site-packages (from matplotlib->roboflow) (1.0.7)\n",
"Requirement already satisfied: charset-normalizer<4,>=2 in /Users/dickr/opt/anaconda3/envs/poker310/lib/python3.10/site-packages (from requests->roboflow) (3.1.0)\n",
"Building wheels for collected packages: wget\n",
" Building wheel for wget (setup.py) ... \u001b[?25ldone\n",
"\u001b[?25h Created wheel for wget: filename=wget-3.2-py3-none-any.whl size=9656 sha256=27857150473a56f528df8a9fcd926a783a1b825a946b134045b015683721cf70\n",
" Stored in directory: /Users/dickr/Library/Caches/pip/wheels/8b/f1/7f/5c94f0a7a505ca1c81cd1d9208ae2064675d97582078e6c769\n",
"Successfully built wget\n",
"Installing collected packages: wget, python-dotenv, pyparsing, idna, cycler, chardet, requests-toolbelt, roboflow\n",
" Attempting uninstall: pyparsing\n",
" Found existing installation: pyparsing 3.0.9\n",
" Uninstalling pyparsing-3.0.9:\n",
" Successfully uninstalled pyparsing-3.0.9\n",
" Attempting uninstall: idna\n",
" Found existing installation: idna 3.4\n",
" Uninstalling idna-3.4:\n",
" Successfully uninstalled idna-3.4\n",
" Attempting uninstall: cycler\n",
" Found existing installation: cycler 0.11.0\n",
" Uninstalling cycler-0.11.0:\n",
" Successfully uninstalled cycler-0.11.0\n",
"Successfully installed chardet-4.0.0 cycler-0.10.0 idna-2.10 pyparsing-2.4.7 python-dotenv-1.0.0 requests-toolbelt-1.0.0 roboflow-1.0.9 wget-3.2\n",
"loading Roboflow workspace...\n",
"loading Roboflow project...\n",
"Downloading Dataset Version Zip in PlayingCards-1 to yolov7pytorch: 100% [34468644 / 34468644] bytes\n"
Expand All @@ -73,7 +42,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"Extracting Dataset Version Zip to PlayingCards-1 in yolov7pytorch:: 100%|██████████| 2032/2032 [00:00<00:00, 4011.74it/s]\n"
"Extracting Dataset Version Zip to PlayingCards-1 in yolov7pytorch:: 100%|██████████| 2032/2032 [00:00<00:00, 6770.38it/s]\n"
]
}
],
Expand All @@ -88,7 +57,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 2,
"metadata": {},
"outputs": [
{
Expand Down
3 changes: 2 additions & 1 deletion poker/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
warnings.filterwarnings("ignore", category=UserWarning)
warnings.filterwarnings("ignore", category=RuntimeWarning)

version = 6.63
version = 6.64
ui = None


Expand Down Expand Up @@ -312,6 +312,7 @@ def exception_hook(exctype, value, traceback):
t1.start()

t2 = threading.Thread(target=local_restapi)
t2.daemon = True
t2.start()

try:
Expand Down
15 changes: 9 additions & 6 deletions poker/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
import inspect
import json
import logging
import os
import sys
from unittest.mock import MagicMock

import json
import pandas as pd
from PIL import Image
import requests
from PIL import Image

from poker import main
from poker.tools.game_logger import GameLogger
from poker.tools.helper import COMPUTER_NAME, get_config
from poker.tools.mongo_manager import MongoManager
from poker.tools.strategy_handler import StrategyHandler
from poker.tools.update_checker import UpdateChecker
from poker import main
from poker.tools.helper import COMPUTER_NAME, get_config

config = get_config()
URL = config.config.get('main','db')
URL = config.config.get('main', 'db')

currentdir = os.path.dirname(os.path.abspath(
inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0, parentdir)


def init_table(file, round_number=0, strategy='Default1'):
def init_table(file, round_number=0, strategy='Default1', table_scraper_name='Official GGPoker 6player'):
# LOG_FILENAME = 'testing.log'
logger = logging.getLogger('tester')
gui_signals = MagicMock()
Expand All @@ -38,6 +39,8 @@ def init_table(file, round_number=0, strategy='Default1'):
h.preflop_sheet = pd.read_excel(
preflop_url, sheet_name=None, engine='openpyxl')
game_logger = GameLogger()
mongo = MongoManager()
table_dict = mongo.get_table(table_scraper_name)
t = main.TableScreenBased(p, {}, gui_signals, game_logger, 0.0)

current_file_dir = os.path.dirname(os.path.abspath(__file__))
Expand Down
9 changes: 0 additions & 9 deletions poker/tools/screen_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import cv2
import numpy as np
from PIL import Image, ImageGrab
from pytesseract import pytesseract
from tesserocr import PyTessBaseAPI, PSM, OEM

from poker.tools.helper import memory_cache, get_dir
Expand Down Expand Up @@ -151,14 +150,6 @@ def get_ocr_number(img_orig, fast=False):
return -1.0


def get_ocr_string(img_orig):
"""Return string value from image."""
img_resized = prepareImage(img_orig)
config_ocr = '--psm 7 --oem 1'

return pytesseract.image_to_string(img_resized, 'eng', config=config_ocr).strip()


def take_screenshot(virtual_box=False):
"""
Take screenshot directly from screen or via virtualbox
Expand Down
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ opencv-python
pillow
pyinstaller
pymongo
pyqt5
pyqt6
pytesseract
virtualbox
Expand All @@ -27,4 +26,6 @@ tqdm
seaborn
PyJWT==1.7.0
flask_jwt_extended
fastapi_jwt_auth
fastapi_auth
uvicorn
tesserocr
1 change: 1 addition & 0 deletions website/.env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_REACT_APP_API_URL=http://localhost:8000
9 changes: 9 additions & 0 deletions website/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@
<link rel="icon" type="image/svg" sizes="32x32" href="assets/pokericon.svg">
<title>DeeperMind Pokerbot: Auto Play on Pokerstars, Partypoker & GG Poker</title>
</head>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-H40Z0W36GF"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'G-H40Z0W36GF');
</script>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
Expand Down
1 change: 1 addition & 0 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"react-bootstrap": "^2.8.0",
"react-chartjs-2": "^5.2.0",
"react-dom": "^18.2.0",
"react-ga": "^3.3.1",
"react-router-dom": "^6.15.0",
"recharts": "^2.7.3",
"victory": "^36.6.11"
Expand Down
1 change: 1 addition & 0 deletions website/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
align-items: center; /* horizontally centered */
justify-content: center; /* vertically centered */
min-height: 100vh; /* or adjust as previously suggested */
margin-top: 3em;
}

.dropdowns-container {
Expand Down
22 changes: 14 additions & 8 deletions website/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
import { BrowserRouter, Route, Routes } from "react-router-dom"
import ReactGA from 'react-ga'
import { BrowserRouter } from "react-router-dom"
import './App.css'
import NavBar from './routes/NavBar'
import PaymentCards from './views/Purchase'
import StrategyAnalyzer from './views/StrategyAnalyzer'
import TableAnalyzer from './views/TableAnalyzer'
import Home from "./views/Home"
import Routing from "./routes/Routing"
import { useEffect } from 'react'


const TRACKING_ID = "UA-7794836-7"; // OUR_TRACKING_ID
ReactGA.initialize(TRACKING_ID);


function App() {

useEffect(() => {
ReactGA.pageview(window.location.pathname + window.location.search);
}, []);

return (
<>
<BrowserRouter>
<NavBar />
<Routing/>
</BrowserRouter>
<NavBar />
<Routing />
</BrowserRouter>
</>
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { Component } from 'react';
import {
BarChart, Bar,
CartesianGrid,
Legend,
Tooltip,
BarChart, Bar,
CartesianGrid,
Legend,
Tooltip,
XAxis, YAxis
} from 'recharts';
// ... (Rest of the imports)
Expand All @@ -21,8 +21,8 @@ class FundsChangeLineChart extends Component {
if (e && e.activePayload && e.activePayload[0]) {
const hoveredData = e.activePayload[0].payload;
if (hoveredData) {
const cursorData = {
name: e.activePayload[0].name,
const cursorData = {
name: e.activePayload[0].name,
value: Number(e.activePayload[0].value).toFixed(2) // Format to 2 decimal places
};
this.setState({ cursorData });
Expand All @@ -31,7 +31,7 @@ class FundsChangeLineChart extends Component {
this.setState({ cursorData: null });
}
}

render() {
const { data } = this.props;

Expand All @@ -41,19 +41,24 @@ class FundsChangeLineChart extends Component {
}));

return (
<BarChart
width={800}
height={200}
data={formattedData}
onMouseMove={this.handleMouseMove}
>
<CartesianGrid strokeDasharray="3 3" />
<XAxis dataKey="date" />
<YAxis />
<Legend />
<Tooltip content={<CustomTooltip cursorData={this.state.cursorData} />} />
<Bar dataKey="value" name="Hands Payoff" fill="#8884d8" />
</BarChart>
<>
<div className="h4">
Payoff for each played hand
</div>
<BarChart
width={800}
height={200}
data={formattedData}
onMouseMove={this.handleMouseMove}
>
<CartesianGrid strokeDasharray="3 3" />
<XAxis dataKey="date" />
<YAxis />
<Legend />
<Tooltip content={<CustomTooltip cursorData={this.state.cursorData} />} />
<Bar dataKey="value" name="Hands Payoff" fill="#8884d8" />
</BarChart>
</>
);
}
}
Expand Down
Loading

0 comments on commit 77b9a69

Please sign in to comment.