Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -77,9 +77,9 @@ def generate_text(request: Request, input_data: InputData):
|
|
| 77 |
generated_response = generate(input_text, history, temperature, max_new_tokens, top_p, repetition_penalty)
|
| 78 |
if input_data.telegramChatId != '' and input_data.telegramUrlBot != '' and input_data.telegramUrlPost != '':
|
| 79 |
asyncio.run(call_telegram_api(input_data, generated_response))
|
| 80 |
-
LoggaTesto("RISPOSTA", {"response": generated_response})
|
| 81 |
-
|
| 82 |
-
return json.dumps({"response": generated_response})
|
| 83 |
else:
|
| 84 |
input_data.asincrono = False
|
| 85 |
if input_data.EliminaRisposteNonPertinenti:
|
|
@@ -99,8 +99,8 @@ def generate_text(request: Request, input_data: InputData):
|
|
| 99 |
result_data = asyncio.run(GeneraTestoAsync("https://matteoscript-fastapi.hf.space/Genera", input_data))
|
| 100 |
#result_data = result_data.replace('"', '')
|
| 101 |
LoggaTesto("RISPOSTA ASINCRONA UNIFICATA", {"response": result_data})
|
| 102 |
-
|
| 103 |
-
return json.dumps({"response": result_data})
|
| 104 |
|
| 105 |
def call_telegram_api_OLD(input_data, text):
|
| 106 |
payload = {
|
|
|
|
| 77 |
generated_response = generate(input_text, history, temperature, max_new_tokens, top_p, repetition_penalty)
|
| 78 |
if input_data.telegramChatId != '' and input_data.telegramUrlBot != '' and input_data.telegramUrlPost != '':
|
| 79 |
asyncio.run(call_telegram_api(input_data, generated_response))
|
| 80 |
+
LoggaTesto("RISPOSTA", {"response": generated_response}, False)
|
| 81 |
+
return {"response": generated_response}
|
| 82 |
+
#return json.dumps({"response": generated_response})
|
| 83 |
else:
|
| 84 |
input_data.asincrono = False
|
| 85 |
if input_data.EliminaRisposteNonPertinenti:
|
|
|
|
| 99 |
result_data = asyncio.run(GeneraTestoAsync("https://matteoscript-fastapi.hf.space/Genera", input_data))
|
| 100 |
#result_data = result_data.replace('"', '')
|
| 101 |
LoggaTesto("RISPOSTA ASINCRONA UNIFICATA", {"response": result_data})
|
| 102 |
+
return {"response": result_data}
|
| 103 |
+
#return json.dumps({"response": result_data})
|
| 104 |
|
| 105 |
def call_telegram_api_OLD(input_data, text):
|
| 106 |
payload = {
|