Spaces:
Sleeping
Sleeping
Update main.py
Browse files156 unmodified lines157158159160160161162163164165165166167167168169170114 unmodified lines285286287288289290288289290291156 unmodified lines result_data = asyncio.run(GeneraTestoAsync("https://matteoscript-fastapi.hf.space/Genera", input_data)) return {"response": result_data}
async def make_request(session, token, data, url, i, max_retries=3):async def make_request(session, token, data, url, index, max_retries=3): headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + token } if (int(i)+1) % 3 == 1: if (int(index)+1) % 3 == 1: data.max_new_tokens = data.max_new_tokens elif (int(i)+1) % 3 == 2: elif (int(index)+1) % 3 == 2: data.max_new_tokens = max(200, data.max_new_tokens - 200) else: data.max_new_tokens = data.max_new_tokens + 200 114 unmodified lines ListaInput = await CreaListaInput(input_data) for data in ListaInput: LoggaTesto("RICHIESTA ASINCRONA", data) for index in range(input_data.NumeroGenerazioni): tasks.append(make_request(session, token, data, index, url)) #tasks.extend([make_request(session, token, data, index, url) for index in range(input_data.NumeroGenerazioni)]) tasks.extend([make_request(session, token, data, index, url) for index in range(input_data.NumeroGenerazioni)]) return await asyncio.gather(*tasks)
main.py+4-6