File size: 955 Bytes
f4e3196
 
21011da
f4e3196
21011da
f4e3196
de093bc
feca41c
f4e3196
21011da
 
 
 
 
 
 
 
f4e3196
 
 
e4f3adb
 
 
 
 
 
 
 
 
 
 
f4e3196
 
06a3097
e4f3adb
1380647
21011da
f4e3196
676e2a2
f4e3196
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
import asyncio
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
import requests
import pandas as pd
import json
import httpx
app = FastAPI()

app.add_middleware(
    CORSMiddleware,
    allow_origins=["*"],
    allow_credentials=True,
    allow_methods=["*"],
    allow_headers=["*"],
)

global page
page = 1
# Declare the continuous function as an async function.
#async def your_continuous_function():
   
            #await asyncio.sleep(60)  # Adjust the sleep interval as needed

# Create a startup event.
#@app.on_event("startup")
#async def startup_event():
    # Start the continuous function as a background task.
    #asyncio.create_task(your_continuous_function())
    
@app.get("/trigger_the_data_fecher_every_60s")
async def your_continuous_function():
    global page

    page+=1
    return "model trained with new page : "+str(page)+" data"

@app.get("/test_api")
async def test_api():
    return "kpi_result"