Spaces:
Build error
Build error
Update main.py
Browse files198 unmodified lines199200201202203204204205206207208209209210211211212213212213214215215216217218219198 unmodified lines data['max_new_tokens'] = max(200, data['max_new_tokens'] - 200) else: data['max_new_tokens'] = data['max_new_tokens'] + 200 timeout = aiohttp.ClientTimeout(total=1000) for _ in range(max_retries): try: async with session.post(url, headers=headers, json=data) as response: async with session.post(url, headers=headers, json=data, timeout=timeout) as response: response.raise_for_status() try: result_data = await response.json() except aiohttp.ContentTypeError: result_data = await response.text() result_data = await response.text() return result_data except (asyncio.TimeoutError, aiohttp.ClientError, requests.exceptions.HTTPError) as e: LoggaTesto("ERRORE ASYNC", {e}, False) if isinstance(e, (asyncio.TimeoutError, requests.exceptions.HTTPError)) and e.response.status in [502, 504]: except (asyncio.TimeoutError, aiohttp.ClientError) as e: LoggaTesto("ERRORE ASYNC", {str(e)}, False) if isinstance(e, aiohttp.ClientError) and e.status in [502, 504]: break await asyncio.sleep(3) await asyncio.sleep(3) raise Exception("Max retries reached or skipping retries. Unable to make the request.")
async def CreaListaInput(input_data):main.py+7-6