Spaces:
Running
Running
Upload 16 files
Browse files- .gitattributes +11 -0
- LICENSE +31 -0
- README.md +14 -0
- app.py +317 -0
- demo (2).mp4 +3 -0
- example1.png +3 -0
- example10.png +3 -0
- example2.png +3 -0
- example3.png +3 -0
- example4.png +3 -0
- example5.png +3 -0
- example6.png +3 -0
- example7.png +3 -0
- example8.png +3 -0
- example9.png +3 -0
- gitattributes +49 -0
- requirements.txt +7 -0
.gitattributes
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
demo[[:space:]](2).mp4 filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
example1.png filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
example10.png filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
example2.png filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
example3.png filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
example4.png filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
example5.png filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
example6.png filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
example7.png filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
example8.png filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
example9.png filter=lfs diff=lfs merge=lfs -text
|
LICENSE
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Copyright (c) 2024. All rights reserved.
|
| 2 |
+
|
| 3 |
+
PROPRIETARY SOFTWARE LICENSE AGREEMENT
|
| 4 |
+
|
| 5 |
+
This software, including all associated files, code, neural network architecture, interfaces, and documentation ("Software") is proprietary and confidential.
|
| 6 |
+
|
| 7 |
+
1. OWNERSHIP AND RESTRICTIONS
|
| 8 |
+
- All intellectual property rights, including but not limited to copyrights, trade secrets, and proprietary information relating to the Software remain with the copyright holder
|
| 9 |
+
- The neural network model, its weights, and training methodology are strictly confidential and proprietary
|
| 10 |
+
- The web interface is for evaluation purposes only
|
| 11 |
+
|
| 12 |
+
2. PROHIBITED ACTIVITIES
|
| 13 |
+
You may not, and you may not permit others to:
|
| 14 |
+
- Copy, modify, or create derivative works of the Software
|
| 15 |
+
- Reverse engineer, decompile, or attempt to extract the source code
|
| 16 |
+
- Use the Software architecture to train similar models
|
| 17 |
+
- Redistribute, sell, rent, lease, sublicense, or transfer any rights to the Software
|
| 18 |
+
- Access or attempt to access the proprietary neural network model without authorization
|
| 19 |
+
|
| 20 |
+
3. INTERFACE ACCESS
|
| 21 |
+
- The web interface is provided for evaluation purposes only
|
| 22 |
+
- Access to the interface does not grant any rights to the underlying proprietary technology
|
| 23 |
+
- Analysis results remain property of the copyright holder
|
| 24 |
+
|
| 25 |
+
4. NO WARRANTY
|
| 26 |
+
The Software is provided "AS IS" without warranty of any kind, express or implied.
|
| 27 |
+
|
| 28 |
+
5. LIMITATION OF LIABILITY
|
| 29 |
+
In no event shall the copyright holder be liable for any claim, damages or other liability arising from the use or distribution of the Software.
|
| 30 |
+
|
| 31 |
+
ALL RIGHTS RESERVED.
|
README.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: AiTradingCrypto
|
| 3 |
+
emoji: 🏃
|
| 4 |
+
colorFrom: gray
|
| 5 |
+
colorTo: green
|
| 6 |
+
sdk: gradio
|
| 7 |
+
sdk_version: 5.7.1
|
| 8 |
+
app_file: app.py
|
| 9 |
+
pinned: false
|
| 10 |
+
license: other
|
| 11 |
+
short_description: New-Generation AI Computer Vision for Cryptocurrency Trading
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
ADDED
|
@@ -0,0 +1,317 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import gradio as gr
|
| 3 |
+
import tensorflow as tf
|
| 4 |
+
import numpy as np
|
| 5 |
+
import cv2
|
| 6 |
+
from PIL import Image
|
| 7 |
+
import logging
|
| 8 |
+
from huggingface_hub import hf_hub_download
|
| 9 |
+
from huggingface_hub import login
|
| 10 |
+
import matplotlib.pyplot as plt
|
| 11 |
+
import matplotlib
|
| 12 |
+
matplotlib.use('Agg')
|
| 13 |
+
|
| 14 |
+
# Настройка логирования
|
| 15 |
+
logging.basicConfig(level=logging.INFO)
|
| 16 |
+
logger = logging.getLogger(__name__)
|
| 17 |
+
|
| 18 |
+
# Проверка наличия токена
|
| 19 |
+
if "HUGGINGFACE_TOKEN" not in os.environ:
|
| 20 |
+
logger.error("HUGGINGFACE_TOKEN not found in environment variables!")
|
| 21 |
+
else:
|
| 22 |
+
logger.info("HUGGINGFACE_TOKEN found")
|
| 23 |
+
# Аутентификация с использованием токена
|
| 24 |
+
login(token=os.environ["HUGGINGFACE_TOKEN"])
|
| 25 |
+
logger.info("Logged in to Hugging Face")
|
| 26 |
+
|
| 27 |
+
# Определение размера изображения
|
| 28 |
+
IMG_SHAPE = (479, 1221, 3)
|
| 29 |
+
|
| 30 |
+
class SecureModel:
|
| 31 |
+
_instance = None
|
| 32 |
+
|
| 33 |
+
def __init__(self):
|
| 34 |
+
try:
|
| 35 |
+
logger.info("Attempting to download model files...")
|
| 36 |
+
|
| 37 |
+
# Загружаем файл модели
|
| 38 |
+
model_path = hf_hub_download(
|
| 39 |
+
repo_id="Dianor/trading-model-private",
|
| 40 |
+
filename="trading_modelbeta0.7.keras",
|
| 41 |
+
token=os.environ["HUGGINGFACE_TOKEN"]
|
| 42 |
+
)
|
| 43 |
+
|
| 44 |
+
# Загружаем файл с кастомными слоями
|
| 45 |
+
layers_path = hf_hub_download(
|
| 46 |
+
repo_id="Dianor/trading-model-private",
|
| 47 |
+
filename="custom_trading_layers.py",
|
| 48 |
+
token=os.environ["HUGGINGFACE_TOKEN"]
|
| 49 |
+
)
|
| 50 |
+
|
| 51 |
+
logger.info(f"Files downloaded successfully")
|
| 52 |
+
|
| 53 |
+
# Импортируем кастомные слои из скачанного модуля
|
| 54 |
+
import importlib.util
|
| 55 |
+
import sys
|
| 56 |
+
|
| 57 |
+
# Загружаем модуль с кастомными слоями
|
| 58 |
+
spec = importlib.util.spec_from_file_location("custom_trading_layers", layers_path)
|
| 59 |
+
custom_module = importlib.util.module_from_spec(spec)
|
| 60 |
+
sys.modules["custom_trading_layers"] = custom_module
|
| 61 |
+
spec.loader.exec_module(custom_module)
|
| 62 |
+
|
| 63 |
+
# Получаем словарь custom_objects
|
| 64 |
+
custom_objects = custom_module.get_custom_objects()
|
| 65 |
+
|
| 66 |
+
# Обновляем глобальные объекты TensorFlow
|
| 67 |
+
tf.keras.utils.get_custom_objects().update(custom_objects)
|
| 68 |
+
|
| 69 |
+
# Загружаем модель
|
| 70 |
+
try:
|
| 71 |
+
self.model = tf.keras.models.load_model(
|
| 72 |
+
model_path,
|
| 73 |
+
custom_objects=custom_objects,
|
| 74 |
+
compile=False
|
| 75 |
+
)
|
| 76 |
+
except Exception as load_error:
|
| 77 |
+
logger.warning(f"Direct load failed: {load_error}")
|
| 78 |
+
self.model = tf.keras.models.load_model(
|
| 79 |
+
model_path,
|
| 80 |
+
custom_objects=custom_objects,
|
| 81 |
+
compile=False
|
| 82 |
+
)
|
| 83 |
+
self.model.compile(
|
| 84 |
+
optimizer='adam',
|
| 85 |
+
loss={
|
| 86 |
+
'long_signal': 'binary_crossentropy',
|
| 87 |
+
'short_signal': 'binary_crossentropy'
|
| 88 |
+
},
|
| 89 |
+
metrics=['accuracy']
|
| 90 |
+
)
|
| 91 |
+
|
| 92 |
+
logger.info("Model loaded successfully")
|
| 93 |
+
except Exception as e:
|
| 94 |
+
logger.error(f"Failed to load model: {str(e)}")
|
| 95 |
+
raise
|
| 96 |
+
|
| 97 |
+
@classmethod
|
| 98 |
+
def get_instance(cls):
|
| 99 |
+
if cls._instance is None:
|
| 100 |
+
cls._instance = cls()
|
| 101 |
+
return cls._instance.model
|
| 102 |
+
|
| 103 |
+
def preprocess_image(image):
|
| 104 |
+
try:
|
| 105 |
+
logger.info(f"Starting preprocessing. Input shape: {image.shape}")
|
| 106 |
+
|
| 107 |
+
# Конвертируем в RGB если нужно (если изображение в BGR)
|
| 108 |
+
if len(image.shape) == 3 and image.shape[2] == 3:
|
| 109 |
+
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
|
| 110 |
+
|
| 111 |
+
image = cv2.resize(image, (IMG_SHAPE[1], IMG_SHAPE[0]))
|
| 112 |
+
|
| 113 |
+
# Используем ту же нормализацию
|
| 114 |
+
image = image.astype('float32') / 255.0
|
| 115 |
+
|
| 116 |
+
logger.info(f"Preprocessed shape: {image.shape}")
|
| 117 |
+
logger.info(f"Value range: [{image.min():.3f}, {image.max():.3f}]")
|
| 118 |
+
|
| 119 |
+
return image
|
| 120 |
+
|
| 121 |
+
except Exception as e:
|
| 122 |
+
logger.error(f"Error in preprocess_image: {str(e)}")
|
| 123 |
+
raise
|
| 124 |
+
|
| 125 |
+
def analyze_trading_chart(input_image):
|
| 126 |
+
try:
|
| 127 |
+
model = SecureModel.get_instance()
|
| 128 |
+
|
| 129 |
+
# Сохраняем оригинал для отображения
|
| 130 |
+
display_image = input_image.copy()
|
| 131 |
+
|
| 132 |
+
# Логируем исходное изображение
|
| 133 |
+
logger.info(f"Raw input shape: {input_image.shape}")
|
| 134 |
+
logger.info(f"Raw input range: [{input_image.min()}, {input_image.max()}]")
|
| 135 |
+
|
| 136 |
+
# Изменяем размер изображения до требуемого
|
| 137 |
+
resized_image = cv2.resize(input_image, (1221, 479), interpolation=cv2.INTER_NEAREST)
|
| 138 |
+
|
| 139 |
+
# Нормализуем изображение
|
| 140 |
+
image = resized_image.astype('float32') / 255.0
|
| 141 |
+
image = np.expand_dims(image, axis=0) # Добавляем batch dimension
|
| 142 |
+
|
| 143 |
+
# Логируем после обработки
|
| 144 |
+
logger.info(f"Processed input shape: {image.shape}")
|
| 145 |
+
logger.info(f"Processed input range: [{image.min():.3f}, {image.max():.3f}]")
|
| 146 |
+
|
| 147 |
+
# Делаем предсказание
|
| 148 |
+
predictions = model.predict(image, verbose=0)
|
| 149 |
+
|
| 150 |
+
# Логируем сырые предсказания
|
| 151 |
+
logger.info(f"Raw predictions: {predictions}")
|
| 152 |
+
|
| 153 |
+
long_signal = float(predictions['long_signal'][0][0])
|
| 154 |
+
short_signal = float(predictions['short_signal'][0][0])
|
| 155 |
+
|
| 156 |
+
logger.info(f"Final predictions: LONG={long_signal:.3f}, SHORT={short_signal:.3f}")
|
| 157 |
+
|
| 158 |
+
# Создаем визуализацию
|
| 159 |
+
plt.style.use('dark_background')
|
| 160 |
+
fig = plt.figure(figsize=(15, 10), facecolor='#1E222D')
|
| 161 |
+
gs = fig.add_gridspec(2, 1, height_ratios=[3, 1], hspace=0.3)
|
| 162 |
+
|
| 163 |
+
# График цены
|
| 164 |
+
ax1 = fig.add_subplot(gs[0])
|
| 165 |
+
ax1.imshow(display_image) # Показываем оригинальное изображение
|
| 166 |
+
ax1.set_title('Trading Chart Analysis', color='#B7BDD7', pad=10, fontsize=14)
|
| 167 |
+
ax1.axis('off')
|
| 168 |
+
|
| 169 |
+
# Панель сигналов
|
| 170 |
+
ax2 = fig.add_subplot(gs[1])
|
| 171 |
+
ax2.set_facecolor('#1E222D')
|
| 172 |
+
|
| 173 |
+
bar_positions = [0, 1]
|
| 174 |
+
signal_values = [long_signal, short_signal]
|
| 175 |
+
colors = ['#26a69a', '#ef5350']
|
| 176 |
+
labels = ['Long Signal', 'Short Signal']
|
| 177 |
+
|
| 178 |
+
bars = ax2.bar(bar_positions, signal_values, color=colors)
|
| 179 |
+
ax2.set_xticks(bar_positions)
|
| 180 |
+
ax2.set_xticklabels(labels, color='#B7BDD7', fontsize=12)
|
| 181 |
+
ax2.set_ylim(0, 1)
|
| 182 |
+
ax2.set_ylabel('Signal Strength', color='#B7BDD7', fontsize=12)
|
| 183 |
+
ax2.grid(True, alpha=0.2)
|
| 184 |
+
ax2.tick_params(colors='#B7BDD7')
|
| 185 |
+
|
| 186 |
+
# Добавляем значения над барами
|
| 187 |
+
for bar in bars:
|
| 188 |
+
height = bar.get_height()
|
| 189 |
+
ax2.text(bar.get_x() + bar.get_width()/2., height,
|
| 190 |
+
f'{height:.3f}',
|
| 191 |
+
ha='center', va='bottom', color='#B7BDD7',
|
| 192 |
+
fontsize=12)
|
| 193 |
+
|
| 194 |
+
ax2.axhline(y=0.8, color='white', linestyle='--', alpha=0.5, label='Signal Threshold')
|
| 195 |
+
ax2.legend(loc='upper right', bbox_to_anchor=(0.98, 0.98))
|
| 196 |
+
|
| 197 |
+
# Конвертируем график в изображение
|
| 198 |
+
fig.canvas.draw()
|
| 199 |
+
buf = fig.canvas.buffer_rgba()
|
| 200 |
+
img = np.asarray(buf)
|
| 201 |
+
plt.close(fig)
|
| 202 |
+
|
| 203 |
+
return img
|
| 204 |
+
|
| 205 |
+
except Exception as e:
|
| 206 |
+
logger.error(f"Error in analyze_trading_chart: {str(e)}")
|
| 207 |
+
logger.exception("Full traceback:")
|
| 208 |
+
return display_image
|
| 209 |
+
|
| 210 |
+
# Создаем интерфейс с табами
|
| 211 |
+
def create_interface():
|
| 212 |
+
with gr.Blocks(theme=gr.themes.Default()) as demo:
|
| 213 |
+
gr.Markdown("""
|
| 214 |
+
# 🚀 Revolutionary Neural Vision Trading
|
| 215 |
+
|
| 216 |
+
## Next-Generation AI Computer Vision for Cryptocurrency Trading
|
| 217 |
+
|
| 218 |
+
Introducing the world's first neural network that trades cryptocurrency through pure visual comprehension—a breakthrough technology that sees charts just like professional traders do.
|
| 219 |
+
|
| 220 |
+
This revolutionary AI doesn't rely on traditional indicators or mathematical patterns. Instead, it employs advanced computer vision to interpret market dynamics visually, analyzing real-time price action with human-like perception but machine-level precision.
|
| 221 |
+
|
| 222 |
+
The system provides confidence-based entry signals, automatically executing trades when conviction reaches 0.9 or higher—mimicking the decision-making process of elite traders while eliminating emotional bias.
|
| 223 |
+
|
| 224 |
+
---
|
| 225 |
+
|
| 226 |
+
### Unprecedented Market Understanding:
|
| 227 |
+
|
| 228 |
+
❗️ Visual price action analysis based on pure Computer Vision
|
| 229 |
+
|
| 230 |
+
❗️ Dynamic support/resistance identification through visual context
|
| 231 |
+
|
| 232 |
+
❗️ Real-time decision making focused on the critical last candle
|
| 233 |
+
|
| 234 |
+
---
|
| 235 |
+
|
| 236 |
+
Try it now! Upload your TradingView/Binance dark theme chart, or use our examples and experience trading intelligence that exists nowhere else in the market.
|
| 237 |
+
|
| 238 |
+
**💼 Limited partnership opportunities available for qualified investors. Contact us to join the visual trading revolution.**
|
| 239 |
+
""")
|
| 240 |
+
|
| 241 |
+
with gr.Tabs():
|
| 242 |
+
# Таб анализа графиков
|
| 243 |
+
with gr.Tab("Signal Analysis"):
|
| 244 |
+
with gr.Row():
|
| 245 |
+
# ��евая колонка для ввода
|
| 246 |
+
with gr.Column(scale=1):
|
| 247 |
+
gr.Markdown("""
|
| 248 |
+
### Upload Your Trading Chart
|
| 249 |
+
Or use example charts below
|
| 250 |
+
""")
|
| 251 |
+
input_image = gr.Image(type="numpy", height=400)
|
| 252 |
+
|
| 253 |
+
# Правая колонка для вывода
|
| 254 |
+
with gr.Column(scale=1):
|
| 255 |
+
gr.Markdown("""
|
| 256 |
+
### Analysis Results
|
| 257 |
+
- Long Signal (Green): Upward movement probability
|
| 258 |
+
- Short Signal (Red): Downward movement probability
|
| 259 |
+
""")
|
| 260 |
+
output_image = gr.Image(type="numpy", height=400)
|
| 261 |
+
|
| 262 |
+
analyze_btn = gr.Button("Analyze Chart", size="lg")
|
| 263 |
+
analyze_btn.click(
|
| 264 |
+
fn=analyze_trading_chart,
|
| 265 |
+
inputs=input_image,
|
| 266 |
+
outputs=output_image
|
| 267 |
+
)
|
| 268 |
+
|
| 269 |
+
gr.Markdown("### Example Charts")
|
| 270 |
+
gr.Examples(
|
| 271 |
+
examples=[
|
| 272 |
+
"example1.png", "example2.png", "example3.png", "example4.png",
|
| 273 |
+
"example5.png", "example6.png", "example7.png", "example8.png",
|
| 274 |
+
"example9.png", "example10.png"
|
| 275 |
+
],
|
| 276 |
+
inputs=input_image,
|
| 277 |
+
outputs=output_image,
|
| 278 |
+
fn=analyze_trading_chart,
|
| 279 |
+
cache_examples=True,
|
| 280 |
+
examples_per_page=10
|
| 281 |
+
)
|
| 282 |
+
|
| 283 |
+
# Таб с демонстрационным видео
|
| 284 |
+
with gr.Tab("Trading Demo"):
|
| 285 |
+
gr.Markdown("""
|
| 286 |
+
## Trading System Backtesting Demo
|
| 287 |
+
Watch how our AI trading system performs in different market conditions.
|
| 288 |
+
""")
|
| 289 |
+
|
| 290 |
+
with gr.Row():
|
| 291 |
+
with gr.Column(scale=1, min_width=800):
|
| 292 |
+
gr.Video("demo.mp4")
|
| 293 |
+
|
| 294 |
+
gr.Markdown("""
|
| 295 |
+
### What you're seeing in the demo:
|
| 296 |
+
- Real-time trading decisions
|
| 297 |
+
- Signal generation and execution
|
| 298 |
+
- Performance metrics and profit visualization
|
| 299 |
+
- Risk management in action
|
| 300 |
+
""")
|
| 301 |
+
|
| 302 |
+
return demo
|
| 303 |
+
|
| 304 |
+
if __name__ == "__main__":
|
| 305 |
+
try:
|
| 306 |
+
logger.info("Initializing model at startup...")
|
| 307 |
+
SecureModel.get_instance()
|
| 308 |
+
logger.info("Model initialized successfully")
|
| 309 |
+
except Exception as e:
|
| 310 |
+
logger.error(f"Failed to initialize model at startup: {str(e)}")
|
| 311 |
+
|
| 312 |
+
demo = create_interface()
|
| 313 |
+
demo.launch(
|
| 314 |
+
server_name="0.0.0.0",
|
| 315 |
+
server_port=7860,
|
| 316 |
+
share=False
|
| 317 |
+
)
|
demo (2).mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9d9083447574f6c6916869939eab2b6a44a03b03b08cc62b31da3d72260b0ab6
|
| 3 |
+
size 33122571
|
example1.png
ADDED
|
Git LFS Details
|
example10.png
ADDED
|
Git LFS Details
|
example2.png
ADDED
|
Git LFS Details
|
example3.png
ADDED
|
Git LFS Details
|
example4.png
ADDED
|
Git LFS Details
|
example5.png
ADDED
|
Git LFS Details
|
example6.png
ADDED
|
Git LFS Details
|
example7.png
ADDED
|
Git LFS Details
|
example8.png
ADDED
|
Git LFS Details
|
example9.png
ADDED
|
Git LFS Details
|
gitattributes
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
demo.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
example1.png filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
example10.png filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
example2.png filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
example3.png filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
example4.png filter=lfs diff=lfs merge=lfs -text
|
| 42 |
+
example5.png filter=lfs diff=lfs merge=lfs -text
|
| 43 |
+
example6.png filter=lfs diff=lfs merge=lfs -text
|
| 44 |
+
example7.png filter=lfs diff=lfs merge=lfs -text
|
| 45 |
+
example8.png filter=lfs diff=lfs merge=lfs -text
|
| 46 |
+
example9.png filter=lfs diff=lfs merge=lfs -text
|
| 47 |
+
example2copy2.PNG filter=lfs diff=lfs merge=lfs -text
|
| 48 |
+
example4copy2.PNG filter=lfs diff=lfs merge=lfs -text
|
| 49 |
+
example6copy.PNG filter=lfs diff=lfs merge=lfs -text
|
requirements.txt
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
tensorflow-cpu==2.18.0
|
| 2 |
+
gradio==3.50.2
|
| 3 |
+
numpy==1.26.0
|
| 4 |
+
Pillow==10.1.0
|
| 5 |
+
opencv-python-headless==4.8.1.78
|
| 6 |
+
huggingface-hub>=0.19.4
|
| 7 |
+
keras==3.5.0
|