Atualli commited on
Commit
497aa85
1 Parent(s): 1cdd82e

Adiciona script e cron-tab

Browse files
.vscode/launch.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ // Use IntelliSense to learn about possible attributes.
3
+ // Hover to view descriptions of existing attributes.
4
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5
+ "version": "0.2.0",
6
+ "configurations": [
7
+
8
+ {
9
+ "name": "Python: Current File",
10
+ "type": "python",
11
+ "request": "launch",
12
+ "program": "${file}",
13
+ "console": "integratedTerminal",
14
+ "justMyCode": true
15
+ }
16
+ ]
17
+ }
app.py CHANGED
@@ -96,4 +96,4 @@ demo_app = gr.Interface(
96
  live=True,
97
  theme='huggingface',
98
  )
99
- demo_app.launch(debug=True, enable_queue=True)
 
96
  live=True,
97
  theme='huggingface',
98
  )
99
+ demo_app.launch(debug=True, server_name="192.168.0.153", server_port=8080, enable_queue=True)
app1.py ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import os
3
+ #os.system("pip -qq install yoloxdetect==0.0.7")
4
+ os.system("pip -qq install yoloxdetect")
5
+ import torch
6
+ import json
7
+ import yoloxdetect2.helpers as yoloxdetect
8
+ #from yoloxdetect import YoloxDetector
9
+
10
+
11
+ # Images
12
+ torch.hub.download_url_to_file('https://github.com/ultralytics/yolov5/raw/master/data/images/zidane.jpg', 'zidane.jpg')
13
+ torch.hub.download_url_to_file('https://raw.githubusercontent.com/obss/sahi/main/tests/data/small-vehicles1.jpeg', 'small-vehicles1.jpeg')
14
+ torch.hub.download_url_to_file('https://raw.githubusercontent.com/Megvii-BaseDetection/YOLOX/main/assets/dog.jpg', 'dog.jpg')
15
+
16
+ model = yoloxdetect.YoloxDetector2('kadirnar/yolox_s-v0.1.1', 'configs.yolox_s', device="cuda", hf_model=True)
17
+
18
+ def yolox_inference(
19
+ image_path: gr.inputs.Image = None,
20
+ model_path: gr.inputs.Dropdown = 'kadirnar/yolox_s-v0.1.1',
21
+ config_path: gr.inputs.Textbox = 'configs.yolox_s',
22
+ image_size: gr.inputs.Slider = 640
23
+ ):
24
+ """
25
+ YOLOX inference function
26
+ Args:
27
+ image: Input image
28
+ model_path: Path to the model
29
+ config_path: Path to the config file
30
+ image_size: Image size
31
+ Returns:
32
+ Rendered image
33
+ """
34
+
35
+ #model = YoloxDetector(model_path, config_path=config_path, device="cpu", hf_model=True)
36
+ #pred = model.predict(image_path=image_path, image_size=image_size)
37
+ pred2 = []
38
+ if model :
39
+ model.torchyolo = True
40
+ pred2 = model.predict(image_path=image_path, image_size=image_size)
41
+ #text = "Ola"
42
+ #print (vars(model))
43
+ #print (pred2[0])
44
+ #print (pred2[1])
45
+ #print (pred2[2])
46
+
47
+
48
+ tensor = {
49
+ "tensorflow": [
50
+ ]
51
+ }
52
+
53
+ if pred2 is not None:
54
+ #print (pred2[3])
55
+ for i, element in enumerate(pred2[0]):
56
+ object = {}
57
+ itemclass = round(pred2[2][i].item())
58
+ object["classe"] = itemclass
59
+ object["nome"] = pred2[3][itemclass]
60
+ object["score"] = pred2[1][i].item()
61
+ object["x"] = element[0].item()
62
+ object["y"] = element[1].item()
63
+ object["w"] = element[2].item()
64
+ object["h"] = element[3].item()
65
+ tensor["tensorflow"].append(object)
66
+
67
+ #print(tensor)
68
+
69
+ text = json.dumps(tensor)
70
+ return text
71
+
72
+
73
+ inputs = [
74
+ gr.inputs.Image(type="filepath", label="Input Image"),
75
+ gr.inputs.Textbox(lines=1, label="Model Path", default="kadirnar/yolox_s-v0.1.1"),
76
+ gr.inputs.Textbox(lines=1, label="Config Path", default="configs.yolox_s"),
77
+ gr.inputs.Slider(minimum=320, maximum=1280, default=640, step=32, label="Image Size"),
78
+ ]
79
+
80
+ outputs = gr.outputs.Image(type="filepath", label="Output Image")
81
+ title = "SIMULADOR PARA RECONHECIMENTO DE IMAGEM"
82
+
83
+ examples = [
84
+ ["small-vehicles1.jpeg", "kadirnar/yolox_m-v0.1.1", "configs.yolox_m", 640],
85
+ ["zidane.jpg", "kadirnar/yolox_s-v0.1.1", "configs.yolox_s", 640],
86
+ ["dog.jpg", "kadirnar/yolox_tiny-v0.1.1", "configs.yolox_tiny", 640],
87
+ ]
88
+
89
+ demo_app = gr.Interface(
90
+ fn=yolox_inference,
91
+ inputs=inputs,
92
+ outputs=["text"],
93
+ title=title,
94
+ examples=examples,
95
+ cache_examples=True,
96
+ live=True,
97
+ theme='huggingface',
98
+ )
99
+ demo_app.launch(debug=True, server_name="192.168.0.153", server_port=8081, enable_queue=True)
checkYolox.sh ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+ export path=/home/atualli/.local/lib/python3.8/site-packages:$PATH
3
+ cd ~/Projetos/huggingface/yoloxTeste
4
+ SERVER=192.168.0.153
5
+ PORT=8080
6
+
7
+ if lsof -Pi :$PORT -sTCP:LISTEN -t >/dev/null ; then
8
+ echo "running"
9
+ else
10
+ ./telegramCrise.sh "reiniciando_yolox_linux_192.168.0.153:8080"
11
+ pkill -f app.py
12
+ python app.py &
13
+ echo "not running"
14
+ fi
15
+
16
+
checkYoloxGPU.sh ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+ export path=/home/atualli/.local/lib/python3.8/site-packages:$PATH
3
+ cd ~/Projetos/huggingface/yoloxTeste_GPU
4
+ SERVER=192.168.0.153
5
+ PORT=8081
6
+
7
+ if lsof -Pi :$PORT -sTCP:LISTEN -t >/dev/null ; then
8
+ echo "running"
9
+ else
10
+ ./telegramCrise.sh "reiniciando_yolox_GPU_linux_192.168.0.153:8081"
11
+ pkill -f app1.py
12
+ python app1.py &
13
+ echo "not running"
14
+ fi
15
+
16
+
configs/__pycache__/__init__.cpython-38.pyc ADDED
Binary file (156 Bytes). View file
 
configs/__pycache__/yolox_s.cpython-38.pyc ADDED
Binary file (678 Bytes). View file
 
dog.jpg ADDED
flagged/Input Image/tmp6pzjxx_c.jpg ADDED
flagged/log.csv ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ Input Image,Model Path,Config Path,Image Size,output,flag,username,timestamp
2
+ /home/atualli/Projetos/huggingface/yoloxTeste/flagged/Input Image/tmp6pzjxx_c.jpg,kadirnar/yolox_m-v0.1.1,configs.yolox_m,640,"{""tensorflow"": [{""classe"": 2, ""nome"": ""car"", ""score"": 0.860845685005188, ""x"": 447.76275634765625, ""y"": 308.4175720214844, ""w"": 496.5997619628906, ""h"": 341.885986328125}, {""classe"": 2, ""nome"": ""car"", ""score"": 0.8513029217720032, ""x"": 765.2677001953125, ""y"": 260.94488525390625, ""w"": 793.2606201171875, ""h"": 283.60516357421875}, {""classe"": 2, ""nome"": ""car"", ""score"": 0.8312921524047852, ""x"": 321.4132385253906, ""y"": 322.1728515625, ""w"": 382.54156494140625, ""h"": 363.3307189941406}, {""classe"": 2, ""nome"": ""car"", ""score"": 0.8271569013595581, ""x"": 834.4190673828125, ""y"": 308.45318603515625, ""w"": 871.917724609375, ""h"": 342.49017333984375}, {""classe"": 2, ""nome"": ""car"", ""score"": 0.7965168952941895, ""x"": 759.3472290039062, ""y"": 230.49676513671875, ""w"": 781.9700927734375, ""h"": 248.99917602539062}, {""classe"": 2, ""nome"": ""car"", ""score"": 0.7932999730110168, ""x"": 719.6497802734375, ""y"": 244.84173583984375, ""w"": 745.8082275390625, ""h"": 270.5390625}, {""classe"": 2, ""nome"": ""car"", ""score"": 0.7723492383956909, ""x"": 701.7979736328125, ""y"": 234.0062713623047, ""w"": 722.4508666992188, ""h"": 252.4764404296875}, {""classe"": 2, ""nome"": ""car"", ""score"": 0.7704324722290039, ""x"": 382.4598693847656, ""y"": 279.06915283203125, ""w"": 418.82550048828125, ""h"": 304.0396728515625}, {""classe"": 2, ""nome"": ""car"", ""score"": 0.7000134587287903, ""x"": 605.7061157226562, ""y"": 239.3345489501953, ""w"": 627.9799194335938, ""h"": 260.09014892578125}, {""classe"": 2, ""nome"": ""car"", ""score"": 0.5757092833518982, ""x"": 564.4542236328125, ""y"": 242.128662109375, ""w"": 588.6491088867188, ""h"": 261.0116882324219}, {""classe"": 2, ""nome"": ""car"", ""score"": 0.5525237321853638, ""x"": 522.3496704101562, ""y"": 223.98187255859375, ""w"": 545.0501708984375, ""h"": 242.4897918701172}, {""classe"": 2, ""nome"": ""car"", ""score"": 0.5518915057182312, ""x"": 620.4938354492188, ""y"": 203.78976440429688, ""w"": 641.4959716796875, ""h"": 218.98069763183594}, {""classe"": 2, ""nome"": ""car"", ""score"": 0.5461263060569763, ""x"": 542.865478515625, ""y"": 234.36563110351562, ""w"": 564.4718017578125, ""h"": 251.56809997558594}, {""classe"": 2, ""nome"": ""car"", ""score"": 0.4599595367908478, ""x"": 784.028564453125, ""y"": 205.95413208007812, ""w"": 801.9844360351562, ""h"": 220.2018585205078}]}",,,2023-05-31 15:58:52.416631
gradio_cached_examples/18/log.csv ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ output,flag,username,timestamp
2
+ "{""tensorflow"": [{""classe"": 2, ""nome"": ""car"", ""score"": 0.8608458638191223, ""x"": 447.76275634765625, ""y"": 308.4176025390625, ""w"": 496.5997619628906, ""h"": 341.8859558105469}, {""classe"": 2, ""nome"": ""car"", ""score"": 0.8513028621673584, ""x"": 765.2677612304688, ""y"": 260.94488525390625, ""w"": 793.2605590820312, ""h"": 283.60516357421875}, {""classe"": 2, ""nome"": ""car"", ""score"": 0.831292450428009, ""x"": 321.4132080078125, ""y"": 322.1728515625, ""w"": 382.54156494140625, ""h"": 363.3307189941406}, {""classe"": 2, ""nome"": ""car"", ""score"": 0.8271573781967163, ""x"": 834.4190673828125, ""y"": 308.45318603515625, ""w"": 871.917724609375, ""h"": 342.49017333984375}, {""classe"": 2, ""nome"": ""car"", ""score"": 0.7965169548988342, ""x"": 759.3472290039062, ""y"": 230.49676513671875, ""w"": 781.9700927734375, ""h"": 248.99917602539062}, {""classe"": 2, ""nome"": ""car"", ""score"": 0.7933003306388855, ""x"": 719.6497802734375, ""y"": 244.84173583984375, ""w"": 745.8082275390625, ""h"": 270.5390625}, {""classe"": 2, ""nome"": ""car"", ""score"": 0.7723491787910461, ""x"": 701.7979736328125, ""y"": 234.00624084472656, ""w"": 722.4508666992188, ""h"": 252.47640991210938}, {""classe"": 2, ""nome"": ""car"", ""score"": 0.7704328298568726, ""x"": 382.4598693847656, ""y"": 279.06915283203125, ""w"": 418.82550048828125, ""h"": 304.0396728515625}, {""classe"": 2, ""nome"": ""car"", ""score"": 0.7000138163566589, ""x"": 605.7061157226562, ""y"": 239.33457946777344, ""w"": 627.9799194335938, ""h"": 260.0901184082031}, {""classe"": 2, ""nome"": ""car"", ""score"": 0.5757095813751221, ""x"": 564.4542236328125, ""y"": 242.12869262695312, ""w"": 588.6491088867188, ""h"": 261.0116882324219}, {""classe"": 2, ""nome"": ""car"", ""score"": 0.5525237917900085, ""x"": 522.349609375, ""y"": 223.98187255859375, ""w"": 545.0501708984375, ""h"": 242.4897918701172}, {""classe"": 2, ""nome"": ""car"", ""score"": 0.551891028881073, ""x"": 620.4938354492188, ""y"": 203.78976440429688, ""w"": 641.4959716796875, ""h"": 218.98069763183594}, {""classe"": 2, ""nome"": ""car"", ""score"": 0.5461264848709106, ""x"": 542.865478515625, ""y"": 234.36563110351562, ""w"": 564.4718017578125, ""h"": 251.56809997558594}, {""classe"": 2, ""nome"": ""car"", ""score"": 0.45995888113975525, ""x"": 784.028564453125, ""y"": 205.9541473388672, ""w"": 801.9844360351562, ""h"": 220.20187377929688}]}",,,2023-04-13 16:46:28.037880
3
+ "{""tensorflow"": [{""classe"": 0, ""nome"": ""person"", ""score"": 0.9197103977203369, ""x"": 747.2991943359375, ""y"": 39.6729736328125, ""w"": 1156.5845947265625, ""h"": 714.814208984375}, {""classe"": 0, ""nome"": ""person"", ""score"": 0.9082562923431396, ""x"": 128.46322631835938, ""y"": 200.10345458984375, ""w"": 1030.4034423828125, ""h"": 714.0289306640625}, {""classe"": 27, ""nome"": ""tie"", ""score"": 0.7234686017036438, ""x"": 443.7471618652344, ""y"": 435.0652160644531, ""w"": 513.2925415039062, ""h"": 719.4329833984375}]}",,,2023-04-13 16:46:28.591237
4
+ "{""tensorflow"": [{""classe"": 1, ""nome"": ""bicycle"", ""score"": 0.9545491933822632, ""x"": 124.5152359008789, ""y"": 118.99075317382812, ""w"": 560.3104858398438, ""h"": 421.1612243652344}, {""classe"": 16, ""nome"": ""dog"", ""score"": 0.913137674331665, ""x"": 134.3090057373047, ""y"": 222.82565307617188, ""w"": 310.2258605957031, ""h"": 549.6795654296875}, {""classe"": 7, ""nome"": ""truck"", ""score"": 0.6118963956832886, ""x"": 462.951904296875, ""y"": 76.86576080322266, ""w"": 694.227783203125, ""h"": 171.76158142089844}, {""classe"": 2, ""nome"": ""car"", ""score"": 0.5663586854934692, ""x"": 466.28363037109375, ""y"": 74.01171112060547, ""w"": 691.0263061523438, ""h"": 174.1538543701172}, {""classe"": 58, ""nome"": ""potted plant"", ""score"": 0.43877777457237244, ""x"": 684.2461547851562, ""y"": 110.87194061279297, ""w"": 716.3640747070312, ""h"": 153.87451171875}]}",,,2023-04-13 16:46:28.855355
small-vehicles1.jpeg ADDED
telegramCrise.sh ADDED
@@ -0,0 +1 @@
 
 
1
+ curl -X POST "https://api.telegram.org/bot766543741:AAE0oO_ni_QYkfS8tZxC-VZt0RJztFiZNHc/sendMessage?chat_id=-927074982&text=$1"
yoloxdetect2/__pycache__/helpers.cpython-38.pyc ADDED
Binary file (2.71 kB). View file
 
zidane.jpg ADDED