fix(huggingface): complete the Inference Providers router migration
Replace the retired api-inference.huggingface.co host with the Inference Providers router (router.huggingface.co): imageConfig.modelMap resolves Hub ids to provider-resolved ids, image-to-image models receive the source image in inputs with the prompt under parameters.prompt, and a new sttConfig wires the hf-inference ASR route. The image catalog grows to 23 models, dead whisper-small is replaced by whisper-large-v3-turbo, the unusable "language" param is dropped, and edit models declare the edit capability so the dashboard offers a source image. Adds unit and end-to-end coverage plus a model-id guard on custom endpoints.
This commit is contained in:
+6
@@ -9,8 +9,14 @@ import { Row, KIND_EXAMPLE_CONFIG } from "./exampleShared";
|
||||
|
||||
const CLOUDFLARE_TEST_IMAGE_URL = "https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog.png";
|
||||
const CLOUDFLARE_TEST_MASK_URL = "https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog-mask.png";
|
||||
// HuggingFace router edit models need a source image; reuse the public dog sample so
|
||||
// the card is runnable as-is. The router derives it from inputs, not from the Hub host.
|
||||
const HUGGINGFACE_TEST_IMAGE_URL = CLOUDFLARE_TEST_IMAGE_URL;
|
||||
|
||||
function getImageEditDefaults(providerId, modelId) {
|
||||
if (providerId === "huggingface") {
|
||||
return { image: HUGGINGFACE_TEST_IMAGE_URL };
|
||||
}
|
||||
if (providerId !== "cloudflare-ai") return {};
|
||||
if (modelId === "@cf/runwayml/stable-diffusion-v1-5-img2img") {
|
||||
return { image: CLOUDFLARE_TEST_IMAGE_URL };
|
||||
|
||||
Reference in New Issue
Block a user