Spaces:
Build error
Build error
Update main.py
Browse files75 unmodified lines767778797980818217 unmodified lines1001011021031031041051065 unmodified lines11211311411511611711811912012112212312412512612775 unmodified lines history = [] generated_response = generate(input_text, history, temperature, max_new_tokens, top_p, repetition_penalty) if input_data.telegramChatId != '' and input_data.telegramUrlBot != '' and input_data.telegramUrlPost != '': call_telegram_api(input_data, generated_response) asyncio.run(call_telegram_api(input_data, generated_response)) LoggaTesto("RISPOSTA", {"response": generated_response}) return {"response": generated_response} else: 17 unmodified lines LoggaTesto("RISPOSTA ASINCRONA UNIFICATA", {"response": result_data}) return {"response": result_data}
def call_telegram_api(input_data, text): def call_telegram_api_OLD(input_data, text): payload = { "chat_id": input_data.telegramChatId, "text": text,5 unmodified lines else: print("Errore nella richiesta POST. Codice di stato:", response.status_code)
async def call_telegram_api(input_data, text): payload = { "chat_id": input_data.telegramChatId, "text": text, "telegramUrl": input_data.telegramUrlBot } async with aiohttp.ClientSession() as session: async with session.post(input_data.telegramUrlPost, json=payload) as response: print(await response.text())
def generate_input_text(input_data): if input_data.instruction.startswith("http"): try:main.py+12-2