Skip to content

Commit db8c610

Browse files
committed
actualizaciones e inicio de integracion python-telegram-bot y discord.py
1 parent 6aaed25 commit db8c610

File tree

10 files changed

+311
-30
lines changed

10 files changed

+311
-30
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,11 @@ Distributed under the MIT License. See `LICENSE.txt` for more information.
208208

209209

210210
<!-- CONTACT -->
211-
## Contact
211+
## Contacto
212212

213-
Your Name - [@your_twitter](https://twitter.com/your_username) - [email protected]
213+
Discord --> [#Raztor#9620](https://discordapp.com/users/330094029696139264) - [email protected]
214214

215-
Project Link: [https://github.com/your_username/repo_name](https://github.com/your_username/repo_name)
215+
Project Link: [https://github.com/raztorr/SIDEAM](https://github.com/raztorr/SIDEAM)
216216

217217
<p align="right">(<a href="#top">back to top</a>)</p>
218218

inicio rapido demo/inicio rapido demo.cmd

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ if '%choice%'=='n' goto :selecrequ
5757
echo instalando Py Torch Cuda...
5858
echo =========================
5959
echo.
60-
pip3 install --no-input torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113
60+
py -m pip install --no-input torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113
6161
goto :selecrequ
6262

6363
:selecrequ
@@ -72,7 +72,7 @@ if '%choice%'=='n' goto :selecinicio
7272

7373
:requirements.txt
7474
echo instalando requirements.txt...
75-
pip3 install --no-input -r requirements.txt
75+
py -m pip install --no-input -r requirements.txt
7676
goto :selecinicio
7777

7878
:selecinicio

modelos/prueba.py

+107
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
"""
2+
Simple Bot to reply to Telegram messages.
3+
4+
First, a few handler functions are defined. Then, those functions are passed to
5+
the Dispatcher and registered at their respective places.
6+
Then, the bot is started and runs until we press Ctrl-C on the command line.
7+
8+
Usage:
9+
Basic Echobot example, repeats messages.
10+
Press Ctrl-C on the command line or send a signal to the process to stop the
11+
bot.
12+
"""
13+
14+
import logging
15+
16+
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
17+
18+
# Enable logging
19+
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
20+
level=logging.INFO)
21+
22+
logger = logging.getLogger(__name__)
23+
24+
25+
26+
chat = {'supergroup_chat_created': False, 'new_chat_members': [], 'message_id': 84, 'new_chat_photo': [], 'entities': [], 'text': 'Hahsjqus', 'delete_chat_photo': False, 'group_chat_created': False, 'caption_entities': [], 'date': 1657929693, 'photo': [], 'channel_chat_created': False, 'chat': {'type': 'private', 'first_name': 'Benja', 'id': 1834202461}, 'from': {'language_code': 'es', 'id': 1834202461, 'is_bot': False, 'first_name': 'Benja'}}
27+
# Define a few command handlers. These usually take the two arguments update and
28+
# context. Error handlers also receive the raised TelegramError object in error.
29+
30+
def codigo_seguridad(codigo):
31+
if codigo == 'PRUEBA_SIDEAM':
32+
return True
33+
else:
34+
return False
35+
36+
def start(update, context):
37+
"""Send a message when the command /start is issued."""
38+
update.message.reply_text('Usa /login código_de_seguridad para iniciar sesion')
39+
40+
def help(update, context):
41+
"""Send a message when the command /help is issued."""
42+
update.message.reply_text('Help!')
43+
44+
45+
def echo(update, context):
46+
"""Echo the user message."""
47+
print(update.message)
48+
print(context)
49+
update.message.reply_text(update.message.text)
50+
51+
def login(update, context):
52+
"""Echo the user message."""
53+
codigo = update.message.text[6:].strip()
54+
valido = codigo_seguridad(codigo)
55+
if valido:
56+
update.message.reply_text(f'Código correcto')
57+
58+
else:
59+
update.message.reply_text(f'Código incorrecto')
60+
61+
def notif():
62+
63+
chat['message'].reply_text(f'Código correcto')
64+
65+
66+
67+
68+
def error(update, context):
69+
"""Log Errors caused by Updates."""
70+
logger.warning('Update "%s" caused error "%s"', update, context.error)
71+
72+
73+
def main():
74+
"""Start the bot."""
75+
# Create the Updater and pass it your bot's token.
76+
# Make sure to set use_context=True to use the new context based callbacks
77+
# Post version 12 this will no longer be necessary
78+
updater = Updater("5404787066:AAGu2V4AcnnYiSsLx4ZzXaj_ohR_4fU-OMQ", use_context=True)
79+
80+
# Get the dispatcher to register handlers
81+
dp = updater.dispatcher
82+
83+
# on different commands - answer in Telegram
84+
dp.add_handler(CommandHandler("start", start))
85+
dp.add_handler(CommandHandler("help", help))
86+
dp.add_handler(CommandHandler("login", login))
87+
# on noncommand i.e message - echo the message on Telegram
88+
dp.add_handler(MessageHandler(Filters.text, echo))
89+
90+
# log all errors
91+
dp.add_error_handler(error)
92+
93+
94+
95+
# Start the Bot
96+
updater.start_polling()
97+
print("Bot started")
98+
notif()
99+
# Run the bot until you press Ctrl-C or the process receives SIGINT,
100+
# SIGTERM or SIGABRT. This should be used most of the time, since
101+
# start_polling() is non-blocking and will stop the bot gracefully.
102+
103+
# updater.idle()
104+
105+
106+
if __name__ == '__main__':
107+
main()

modelos/sideam-old.pt

13.8 MB
Binary file not shown.

modelos/sideam.pt

-172 KB
Binary file not shown.

modulos/discord.py

Whitespace-only changes.

modulos/telegram.py

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import logging
2+
3+
from aiogram import Bot, Dispatcher, executor, types
4+
5+
API_TOKEN = '5404787066:AAGu2V4AcnnYiSsLx4ZzXaj_ohR_4fU-OMQ'
6+
7+
# Configure logging
8+
logging.basicConfig(level=logging.INFO)
9+
10+
# Initialize bot and dispatcher
11+
bot = Bot(token=API_TOKEN)
12+
dp = Dispatcher(bot)
13+
14+
@dp.message_handler()
15+
async def echo(message: types.Message):
16+
# old style:
17+
# await bot.send_message(message.chat.id, message.text)
18+
19+
await message.answer(message.text)
20+
21+
22+
if __name__ == '__main__':
23+
executor.start_polling(dp, skip_updates=True)

prer.md

+167
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
<div id="top"></div>
2+
<!--
3+
*** Thanks for checking out the Best-README-Template. If you have a suggestiondawd
4+
*** that would make this better, please fork the repo and create a pull request
5+
*** or simply open an issue with the tag "enhancement".
6+
*** Don't forget to give the project a star!
7+
*** Thanks again! Now go create something AMAZING! :D
8+
-->
9+
10+
11+
12+
<!-- PROJECT SHIELDS -->
13+
<!--
14+
*** I'm using markdown "reference style" links for readability.
15+
16+
![screenshot](https://user-images.githubusercontent.com/71042858/166175994-440cdf76-b214-4bf4-a853-7012868f80dc.png)
17+
18+
<!-- ABOUT THE PROJECT -->
19+
# Sobre el proyecto
20+
21+
[![Contributors][contributors-shield]][contributors-url]
22+
[![Forks][forks-shield]][forks-url]
23+
[![Stargazers][stars-shield]][stars-url]
24+
[![Issues][issues-shield]][issues-url]
25+
[![MIT License][license-shield]][license-url]
26+
27+
28+
29+
30+
<!-- PROJECT LOGO -->
31+
<br />
32+
<div align="center">
33+
<a href="https://github.com/raztorr/sideam">
34+
<img src="https://user-images.githubusercontent.com/71042858/166176005-45116dd0-2ade-4dbc-af5f-6ce8afb2fcb5.png" alt="Logo" width="80" height="80">
35+
</a>
36+
37+
<h3 align="center">SIDEAM</h3>
38+
39+
<p align="center">
40+
Reconocimiento de armas en tiempo real
41+
<br />
42+
<a href="https://github.com/Raztorr/SIDEAM/wiki"><strong>Explorar la Wiki »</strong></a>
43+
<br />
44+
<br />
45+
<a href="https://github.com/Raztorr/SIDEAM-launch">Revisa el script de inicio rapido</a>
46+
·
47+
<a href="https://github.com/Raztorr/SIDEAM/wiki/Blog">Revisa nuestro Blog</a>
48+
·
49+
<a href="https://github.com/Raztorr/SIDEAM/issues">Reporta un error</a>
50+
</p>
51+
</div>
52+
53+
54+
55+
<!-- TABLE OF CONTENTS -->
56+
<details>
57+
<summary>INDICE</summary>
58+
<ol>
59+
<li>
60+
<a href="#Sobre el proyecto">Sobre el proyecto</a>
61+
<ul>
62+
<li><a href="#Como funciona el proyecto">Como funciona el proyecto</a></li>
63+
</ul>
64+
</li>
65+
<li>
66+
<a href="#Empezando">Empezando</a>
67+
<ul>
68+
<li><a href="#Objetos necesarios">Objetos necesarios</a></li>
69+
<li><a href="#Instalacion">Instalacion</a></li>
70+
</ul>
71+
</li>
72+
<li><a href="#Pasos a seguir que se hicieron">Pasos a seguir que se hicieron</a></li>
73+
<li><a href="#Contacto">Contacto</a></li>
74+
</ol>
75+
</details>
76+
77+
78+
<!-- Sobre el proyecto -->
79+
## Sobre el proyecto
80+
81+
[![Product Name Screen Shot][product-screenshot]](https://github.com/raztorr/sideam)
82+
83+
Sideam es un software de reconocimiento de armas (actualmente en esta versión 1.0 solo de pistolas) que se apoya del uso de una raspberry pi (con cámara) y un servidor que procese la imagen de preferencia con una tarjeta grafica buena.
84+
85+
### Porque crear esto
86+
87+
Esto puede servir para la seguridad en general ya que en caso de alguien quiera ocupar un arma en un lugar donde no esten permitidas Sideam podría llamar a las autoridades pertinentes o mandarle una notificación al usuario de sideam.
88+
89+
Actualmente sabemos que estados unidos están sufriendo una crisis con las armas de fuego debido a que los estudiantes de estos establecimientos usan estas para quitarles la vida a sus compañeros haciendo masacres de menores de edad, esto sucede por muchos factores, pero Sideam puede ayudar a detectar el uso del arma y mandar una notificación a las autoridades para tratar de minimizar la cantidad de muertes totales, y Sideam no solo se puede aplicar para estos casos si no que se puede aplicar a otros países e instituciones donde tener un arma de fuego sea malo para las personas del lugar.
90+
91+
92+
<p align="right">(<a href="#top">back to top</a>)</p>
93+
94+
95+
96+
### Como Funciona el proyecto
97+
98+
Fue creado con una camara que esta conectada a una raspberry pi, esta camara manda el video a un computador externo(con preferencia una tarjeta grafica dedicada) que funciona de servidor para procesar el video de la raspberry con la inteligencia artificial esta detecta si en el video existe alguna pistola y se muestra en la pantalla un cuadro donde se muestra la ubicacion de la pistola.
99+
100+
El proyecto fue creado en su mayoria con Yolov 5(Un proyecto de Github) y una base de datos con fotos de pistolas para entrenar la I.A.
101+
102+
* [Yolov5](https://github.com/ultralytics/yolov5)
103+
104+
<p align="right">(<a href="#top">back to top</a>)</p>
105+
106+
107+
108+
<!-- Empezando -->
109+
## Empezando
110+
111+
Se conecta el video producido de la raspberry a un servidor externo para que procese el video con la inteligencia artificial para que detecte el arma de fuego
112+
113+
### Objetos necesarios
114+
115+
- Una rasoberry pi
116+
- Un servidor con una tarjeta grafica dedicada
117+
- Alguna forma para conectarse(Mediante internet o por cable)
118+
119+
### Instalacion
120+
121+
NO se como se instalaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa supomgo que se descarga descarga toda la wea pero no lo se aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
122+
123+
<p align="right">(<a href="#top">back to top</a>)</p>
124+
125+
126+
<!-- Pasos a seguir que se hicieron -->
127+
## Pasos a seguir que se hicieron
128+
129+
- [x] Poner en funcionamiento la raspberry
130+
- [x] Conseguir una base de datos con fotos de armas
131+
- [x] Entrenar a la inteligencia artificial
132+
- [x] Conectar el servidor con la raspberry
133+
- [x] Conectar el servidor con la inteligencia artificial
134+
- [x] Probar el proyecto con una pistola o imitacion para saber que funciona
135+
- [x] Terminar el github
136+
137+
<p align="right">(<a href="#top">back to top</a>)</p>
138+
139+
140+
141+
142+
143+
<!-- Contacto -->
144+
## Contacto
145+
146+
Link del proyecto: [](https://github.com/Raztorr/SIDEAM)
147+
148+
<p align="right">(<a href="#top">back to top</a>)</p>
149+
150+
151+
152+
<!-- MARKDOWN LINKS & IMAGES -->
153+
<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->
154+
[contributors-shield]: https://img.shields.io/github/contributors/raztorr/sideam.svg?style=for-the-badge
155+
[contributors-url]: https://github.com/raztorr/sideam/graphs/contributors
156+
[forks-shield]: https://img.shields.io/github/forks/raztorr/sideam.svg?style=for-the-badge
157+
[forks-url]: https://github.com/raztorr/sideam/network/members
158+
[stars-shield]: https://img.shields.io/github/stars/raztorr/sideam.svg?style=for-the-badge
159+
[stars-url]: https://github.com/raztorr/sideam/stargazers
160+
[issues-shield]: https://img.shields.io/github/issues/raztorr/sideam.svg?style=for-the-badge
161+
[issues-url]: https://github.com/raztorr/sideam/issues
162+
[license-shield]: https://img.shields.io/github/license/raztorr/sideam.svg?style=for-the-badge
163+
[license-url]: https://github.com/raztorr/sideam/blob/master/LICENSE.txt
164+
[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=555
165+
[linkedin-url]: https://linkedin.com/in/raztorr
166+
[product-screenshot]: https://user-images.githubusercontent.com/71042858/166176326-05f4b664-0eea-4099-b248-317622d4dc8f.png
167+

requirements.txt

42 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)