Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
|
@@ -78,7 +78,8 @@ def generate_text(request: Request, input_data: InputData):
|
|
| 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 |
-
return {"response": generated_response}
|
|
|
|
| 82 |
else:
|
| 83 |
input_data.asincrono = False
|
| 84 |
if input_data.EliminaRisposteNonPertinenti:
|
|
@@ -98,7 +99,8 @@ def generate_text(request: Request, input_data: InputData):
|
|
| 98 |
result_data = asyncio.run(GeneraTestoAsync("https://matteoscript-fastapi.hf.space/Genera", input_data))
|
| 99 |
#result_data = result_data.replace('"', '')
|
| 100 |
LoggaTesto("RISPOSTA ASINCRONA UNIFICATA", {"response": result_data})
|
| 101 |
-
return {"response": result_data}
|
|
|
|
| 102 |
|
| 103 |
def call_telegram_api_OLD(input_data, text):
|
| 104 |
payload = {
|
|
|
|
| 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 |
+
#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 = {
|