Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -59,9 +59,8 @@ def LoggaTesto(log_type, data, serializza=True):
|
|
59 |
print(f"\n{datetime.now()}: ---------------------------------------------------------------| {log_type} |--------------------------------------------------------------\n{formatted_data}")
|
60 |
|
61 |
def NormalizzaJSON(stringa):
|
62 |
-
|
63 |
-
|
64 |
-
return json_result
|
65 |
|
66 |
#--------------------------------------------------- Generazione TESTO ------------------------------------------------------
|
67 |
@app.post("/Genera")
|
@@ -77,7 +76,7 @@ def generate_text(request: Request, input_data: InputData):
|
|
77 |
history = []
|
78 |
generated_response = generate(input_text, history, temperature, max_new_tokens, top_p, repetition_penalty)
|
79 |
RispostaJSON = NormalizzaJSON(generated_response)
|
80 |
-
LoggaTesto("RISPOSTA", RispostaJSON)
|
81 |
return RispostaJSON
|
82 |
else:
|
83 |
input_data.asincrono = False
|
|
|
59 |
print(f"\n{datetime.now()}: ---------------------------------------------------------------| {log_type} |--------------------------------------------------------------\n{formatted_data}")
|
60 |
|
61 |
def NormalizzaJSON(stringa):
|
62 |
+
json_result = json.dumps(stringa)
|
63 |
+
return {"response": json_result}
|
|
|
64 |
|
65 |
#--------------------------------------------------- Generazione TESTO ------------------------------------------------------
|
66 |
@app.post("/Genera")
|
|
|
76 |
history = []
|
77 |
generated_response = generate(input_text, history, temperature, max_new_tokens, top_p, repetition_penalty)
|
78 |
RispostaJSON = NormalizzaJSON(generated_response)
|
79 |
+
LoggaTesto("RISPOSTA", RispostaJSON})
|
80 |
return RispostaJSON
|
81 |
else:
|
82 |
input_data.asincrono = False
|