File size: 1,121 Bytes
1bc8781
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6410048
1bc8781
 
6410048
1bc8781
1a3de10
1bc8781
1a3de10
1bc8781
 
 
 
 
 
 
 
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
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
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')




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)