Spaces:
Sleeping
Sleeping
File size: 3,217 Bytes
1bc8781 8893f39 eed2326 1bc8781 54f62d8 1bc8781 6410048 1bc8781 6410048 1bc8781 1a3de10 fd8681a 71d387b 1bc8781 94cebf0 fd8681a 71d387b 1bc8781 14a8b61 0bb6a33 658d835 2d354b5 658d835 0bb3bb0 f2172f4 0bb3bb0 cfdffcb 2e457b9 d0794d4 3b905ea d0794d4 1471cb0 cfdffcb 51c254a a1228da 54f62d8 47e61e5 a1228da 54f62d8 51c254a 0bb3bb0 e964357 f5a2840 e964357 cfdffcb 1bc8781 4d9867d 78d3b7b 1bc8781 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
import os
from datasets import load_dataset
import json
import uuid
from pathlib import Path
import json
from datasets import load_dataset
from flask import Flask, request, jsonify, Response
import requests
from flask_cors import CORS
from flask_apscheduler import APScheduler
import shutil
from PIL import Image
#import sqlite3
from huggingface_hub import Repository
import subprocess
app = Flask(__name__, static_url_path='/static')
CORS(app)
Path("static/images").mkdir(parents=True, exist_ok=True)
def update_repository():
print("Updating repository")
@ app.route('/operacao')
def index():
return app.send_static_file('operacao.html')
@ app.route('/operacaoTemplate.html')
def operacao():
return app.send_static_file('operacaoTemplate.html')
@ app.route('/testeface')
def operacao():
return app.send_static_file('testeface.html')
@ app.route('/getresource', methods=['GET'])
def getresource():
res = request.args.get('r')
return app.send_static_file(res)
@ app.route('/novo-front/<file>')
def novofront(file):
return app.send_static_file('novo-front/'+file+'.html')
@ app.route('/novo-front/css/<file>')
def novofrontcss(file):
return app.send_static_file('novo-front/css/'+file)
@ app.route('/novo-front/img/<file>')
def novofrontimg(file):
return app.send_static_file('novo-front/img/'+file)
@ app.route('/autentica', methods=['GET'])
def autentica():
email = request.args.get('email')
passw = request.args.get('passw')
newurl = 'http://painel.atualli.com/autentica?email='+email+'&passw='+passw
res = requests.get(newurl)
response = Response(res.content, res.status_code, res.headers)
return response
@ app.route('/proxyimg', methods=['GET'])
def proxyimg():
newurl = request.args.get('prox')
#newurl = "http://painel.atualli.com:8098/getcamera?c=12"
print(newurl)
res = requests.get(newurl)
print(res)
response = Response(res.content, res.status_code, res.headers)
return response
@ app.route('/getdatamosaico', methods=['GET'])
def getdatamosaico():
cliente = request.args.get('cliente')
operador = request.args.get('operador')
newurl = 'http://painel.atualli.com/getdatamosaico?cliente='+cliente+"&operador="+operador
res = requests.get(newurl)
response = Response(res.content, res.status_code, res.headers)
return response
@ app.route('/getdatalocal', methods=['GET'])
def getdatalocal():
comando = request.args.get('comando')
login = request.args.get('login')
newurl = 'http://painel.atualli.com/getdatalocal?comando='+comando+"&login="+login
res = requests.get(newurl)
response = Response(res.content, res.status_code, res.headers)
return response
if __name__ == '__main__':
mode = os.environ.get('FLASK_ENV', 'production')
print(mode)
dev = mode == 'development'
print("Starting scheduler -- Running Production")
scheduler = APScheduler()
scheduler.add_job(id='Update Dataset Repository',
func=update_repository, trigger='interval', hours=1)
scheduler.start()
app.run(host='0.0.0.0', port=int(
os.environ.get('PORT', 7860)), debug=True, use_reloader=dev)
|