Update handler.py
Browse files- 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":
|
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)}]
|