Spaces:
Sleeping
Sleeping
File size: 2,108 Bytes
1bc8781 8893f39 eed2326 1bc8781 6410048 1bc8781 6410048 1bc8781 1a3de10 fd8681a 71d387b 1bc8781 94cebf0 fd8681a 71d387b 1bc8781 0bb6a33 658d835 2d354b5 658d835 0bb3bb0 f2172f4 0bb3bb0 cfdffcb 2e457b9 d0794d4 3b905ea d0794d4 3b905ea cfdffcb 0bb3bb0 cfdffcb 5b172f5 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 |
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('/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
print(newurl)
res = requests.get(newurl)
response = Response(res.content, res.status_code, 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)
|