Aktraiser commited on
Commit
37b22c3
·
verified ·
1 Parent(s): 9823ac3

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +4 -4
handler.py CHANGED
@@ -48,10 +48,10 @@ class EndpointHandler:
48
  **generation_kwargs
49
  )
50
 
51
- # Formater la sortie
52
  if isinstance(outputs, list):
53
- return {"generated_text": outputs[0]["generated_text"]}
54
- return {"generated_text": outputs["generated_text"]}
55
 
56
  except Exception as e:
57
- return {"error": str(e)}
 
48
  **generation_kwargs
49
  )
50
 
51
+ # Formater la sortie en tableau comme requis par l'API
52
  if isinstance(outputs, list):
53
+ return [{"generated_text": output["generated_text"]} for output in outputs]
54
+ return [{"generated_text": outputs["generated_text"]}]
55
 
56
  except Exception as e:
57
+ return [{"error": str(e)}]