Spaces:
Paused
Paused
feat(parse): parse output
Browse files
main.py
CHANGED
|
@@ -136,10 +136,17 @@ def generate_text(request: GenerationRequest) -> dict[str, Any]:
|
|
| 136 |
sampling_params=sampling_params
|
| 137 |
)
|
| 138 |
|
| 139 |
-
output: str =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
|
| 141 |
return {
|
| 142 |
-
"output":
|
| 143 |
}
|
| 144 |
|
| 145 |
except Exception as e:
|
|
|
|
| 136 |
sampling_params=sampling_params
|
| 137 |
)
|
| 138 |
|
| 139 |
+
output: dict[str, Any] = {}
|
| 140 |
+
for item in response:
|
| 141 |
+
outputs: list[dict[str, Any]] = []
|
| 142 |
+
for out in item.outputs:
|
| 143 |
+
outputs.append({
|
| 144 |
+
"text": out.text,
|
| 145 |
+
})
|
| 146 |
+
output["output"] = outputs
|
| 147 |
|
| 148 |
return {
|
| 149 |
+
"output": output,
|
| 150 |
}
|
| 151 |
|
| 152 |
except Exception as e:
|