MatteoScript commited on
Commit
a358ea0
·
verified ·
1 Parent(s): 2064031

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +4 -3
main.py CHANGED
@@ -67,11 +67,11 @@ def generate_text(request: Request, input_data: InputData):
67
  top_p = input_data.top_p
68
  repetition_penalty = input_data.repetition_penalty
69
  input_text = generate_input_text(input_data)
70
- LoggaTesto("RICHIESTA SINCRONA", input_text, False)
71
  max_new_tokens = min(max_new_tokens, 29500 - len(input_text))
72
  history = []
73
  generated_response = generate(input_text, history, temperature, max_new_tokens, top_p, repetition_penalty)
74
- LoggaTesto("RISPOSTA SINCRONA", {"response": generated_response})
75
  return {"response": generated_response}
76
  else:
77
  input_data.asincrono = False
@@ -80,7 +80,7 @@ def generate_text(request: Request, input_data: InputData):
80
  input_data.input = input_data.input + msgEliminaRisposteNonPertinenti
81
  input_data.systemRole = input_data.systemRole + msgEliminaRisposteNonPertinenti
82
  result_data = asyncio.run(GeneraTestoAsync("https://matteoscript-fastapi.hf.space/Genera", input_data))
83
- LoggaTesto("RISPOSTA ASINCRONA FINALE", {"response": result_data})
84
  if input_data.EliminaRisposteNonPertinenti:
85
  result_data = [item for item in result_data if "NOTFOUND" not in item["response"]]
86
  if input_data.UnificaRispostaPertinente:
@@ -89,6 +89,7 @@ def generate_text(request: Request, input_data: InputData):
89
  input_data.systemStyle = 'Rispondi in ITALIANO'
90
  input_data.instruction =''
91
  result_data = asyncio.run(GeneraTestoAsync("https://matteoscript-fastapi.hf.space/Genera", input_data))
 
92
  return {"response": result_data}
93
 
94
  def generate_input_text(input_data):
 
67
  top_p = input_data.top_p
68
  repetition_penalty = input_data.repetition_penalty
69
  input_text = generate_input_text(input_data)
70
+ LoggaTesto("RICHIESTA", input_text, False)
71
  max_new_tokens = min(max_new_tokens, 29500 - len(input_text))
72
  history = []
73
  generated_response = generate(input_text, history, temperature, max_new_tokens, top_p, repetition_penalty)
74
+ LoggaTesto("RISPOSTA", {"response": generated_response})
75
  return {"response": generated_response}
76
  else:
77
  input_data.asincrono = False
 
80
  input_data.input = input_data.input + msgEliminaRisposteNonPertinenti
81
  input_data.systemRole = input_data.systemRole + msgEliminaRisposteNonPertinenti
82
  result_data = asyncio.run(GeneraTestoAsync("https://matteoscript-fastapi.hf.space/Genera", input_data))
83
+ LoggaTesto("RISPOSTA ASINCRONA", {"response": result_data})
84
  if input_data.EliminaRisposteNonPertinenti:
85
  result_data = [item for item in result_data if "NOTFOUND" not in item["response"]]
86
  if input_data.UnificaRispostaPertinente:
 
89
  input_data.systemStyle = 'Rispondi in ITALIANO'
90
  input_data.instruction =''
91
  result_data = asyncio.run(GeneraTestoAsync("https://matteoscript-fastapi.hf.space/Genera", input_data))
92
+ LoggaTesto("RISPOSTA ASINCRONA UNIFICATA", {"response": result_data})
93
  return {"response": result_data}
94
 
95
  def generate_input_text(input_data):