Mauro24 commited on
Commit
9f31e97
·
verified ·
1 Parent(s): 09bc8bd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -30,11 +30,11 @@ def riassumi_testo(testo, max_token_riassunto):
30
  temperature=0.5, # Imposta la creatività
31
  )
32
 
33
- # Estrai il riassunto dalla risposta
34
- riassunto = risposta.choices[0].message['content'] # Correzione nella lettura del riassunto
35
  return riassunto
36
 
37
- except openai.error.BadRequestError as e: # Gestisci errore nella richiesta
38
  return f"Errore nella richiesta: {e}"
39
  except openai.error.AuthenticationError:
40
  return "Errore di autenticazione: chiave API non valida."
@@ -60,3 +60,4 @@ if __name__ == "__main__":
60
 
61
 
62
 
 
 
30
  temperature=0.5, # Imposta la creatività
31
  )
32
 
33
+ # Estrai il riassunto dalla risposta correttamente
34
+ riassunto = risposta['choices'][0]['message']['content'] # Correzione dell'accesso
35
  return riassunto
36
 
37
+ except openai.error.InvalidRequestError as e: # Gestisci errore nella richiesta
38
  return f"Errore nella richiesta: {e}"
39
  except openai.error.AuthenticationError:
40
  return "Errore di autenticazione: chiave API non valida."
 
60
 
61
 
62
 
63
+