Spaces:
Sleeping
Sleeping
Update main.py
Browse files75 unmodified lines7677787980818217 unmodified lines1001011021031041051065 unmodified lines11211311411511611775 unmodified lineshistory = []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)LoggaTesto("RISPOSTA", {"response": generated_response})return {"response": generated_response}else:17 unmodified linesLoggaTesto("RISPOSTA ASINCRONA UNIFICATA", {"response": result_data})return {"response": result_data}def call_telegram_api(input_data, text):payload = {"chat_id": input_data.telegramChatId,"text": text,5 unmodified lineselse:print("Errore nella richiesta POST. Codice di stato:", response.status_code)def generate_input_text(input_data):if input_data.instruction.startswith("http"):try:75 unmodified lines7677787980818217 unmodified lines1001011021031041051065 unmodified lines11211311411511611711811912012112212312412512612775 unmodified lineshistory = []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 != '':asyncio.run(call_telegram_api(input_data, generated_response))LoggaTesto("RISPOSTA", {"response": generated_response})return {"response": generated_response}else:17 unmodified linesLoggaTesto("RISPOSTA ASINCRONA UNIFICATA", {"response": result_data})return {"response": result_data}def call_telegram_api_OLD(input_data, text):payload = {"chat_id": input_data.telegramChatId,"text": text,5 unmodified lineselse: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