Commit f1edf12
fix(inference): support string URL output in Replicate text-to-image (#1835)
This PR adds support for Replicate text-to-image models that return a
single URL string instead of an array of URLs.
This should fix
replicate/huggingface-model-mappings#31, which
is currently failing:
<img width="1048" height="432" alt="image"
src="https://github.com/user-attachments/assets/a9750364-7b8d-4f2f-96e9-4a1afb39af40"
/>
## Solution
The `ReplicateTextToImageTask.getResponse` method previously only
handled array outputs, causing errors for models that return a single
string URL. This change makes the text-to-image implementation
consistent with other tasks like `ReplicateImageToImageTask` and
`ReplicateTextToVideoTask`, which already support both formats.
## Prompts
> Does the replicate text-to-image implementation in this codebase
support models that return a URL as output? Or does it always expect an
array of image URLs?
> Let's update it to allow URL strings as a valid output response
> commit the changes to a branch, push it, and open a PR against the
upstream repo: huggingface/huggingface.js
---------
Co-authored-by: Celina Hanouti <hanouticelina@gmail.com>1 parent 32f0da0 commit f1edf12
1 file changed
+14
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
98 | 112 | | |
99 | 113 | | |
100 | 114 | | |
| |||
0 commit comments