Skip to content

Commit 509fae6

Browse files
committed
feat: add Fal.AI as new generation backend with FLUX models support
1 parent 9ebbe97 commit 509fae6

107 files changed

Lines changed: 5596 additions & 13 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ android {
2626
buildConfigField("String", "HORDE_AI_URL", "\"https://stablehorde.net/\"")
2727
buildConfigField("String", "OPEN_AI_URL", "\"https://api.openai.com/\"")
2828
buildConfigField("String", "STABILITY_AI_URL", "\"https://api.stability.ai/\"")
29+
buildConfigField("String", "FAL_AI_URL", "\"https://queue.fal.run/\"")
2930

3031
buildConfigField("String", "HORDE_AI_SIGN_UP_URL", "\"https://stablehorde.net/register\"")
3132
buildConfigField("String", "HUGGING_FACE_INFO_URL", "\"https://huggingface.co/docs/api-inference/index\"")
3233
buildConfigField("String", "OPEN_AI_INFO_URL", "\"https://platform.openai.com/api-keys\"")
3334
buildConfigField("String", "STABILITY_AI_INFO_URL", "\"https://platform.stability.ai/\"")
35+
buildConfigField("String", "FAL_AI_INFO_URL", "\"https://fal.ai/dashboard/keys\"")
3436
buildConfigField("String", "UPDATE_API_URL", "\"https://sdai.moroz.cc\"")
3537
buildConfigField("String", "REPORT_API_URL", "\"https://sdai-report.moroz.cc\"")
3638
buildConfigField("String", "DEMO_MODE_API_URL", "\"https://sdai.moroz.cc\"")
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"openapi":"3.0.4","info":{"title":"Queue OpenAPI for fal-ai/flux-2/edit","version":"1.0.0","description":"The OpenAPI schema for the fal-ai/flux-2/edit queue.","x-fal-metadata":{"endpointId":"fal-ai/flux-2/edit","category":"image-to-image","thumbnailUrl":"https://v3b.fal.media/files/b/panda/zYjw3YqOcfDQymX7cvMBl_3d76809c48f74eb9abe3e17e1bdd5d2d.jpg","playgroundUrl":"https://fal.ai/models/fal-ai/flux-2/edit","documentationUrl":"https://fal.ai/models/fal-ai/flux-2/edit/api"}},"components":{"securitySchemes":{"apiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Fal Key"}},"schemas":{"QueueStatus":{"type":"object","properties":{"status":{"type":"string","enum":["IN_QUEUE","IN_PROGRESS","COMPLETED"]},"request_id":{"type":"string","description":"The request id."},"response_url":{"type":"string","description":"The response url."},"status_url":{"type":"string","description":"The status url."},"cancel_url":{"type":"string","description":"The cancel url."},"logs":{"type":"object","description":"The logs.","additionalProperties":true},"metrics":{"type":"object","description":"The metrics.","additionalProperties":true},"queue_position":{"type":"integer","description":"The queue position."}},"required":["status","request_id"]},"Flux2EditInput":{"x-fal-order-properties":["prompt","guidance_scale","seed","num_inference_steps","image_size","num_images","acceleration","enable_prompt_expansion","sync_mode","enable_safety_checker","output_format","image_urls"],"type":"object","properties":{"prompt":{"examples":["Change his clothes to casual suit and tie"],"description":"The prompt to edit the image.","type":"string","title":"Prompt"},"num_images":{"minimum":1,"description":"The number of images to generate.","type":"integer","title":"Number of Images","maximum":4,"default":1},"image_size":{"anyOf":[{"$ref":"#/components/schemas/ImageSize"},{"enum":["square_hd","square","portrait_4_3","portrait_16_9","landscape_4_3","landscape_16_9"],"type":"string"}],"description":"The size of the image to generate. The width and height must be between 512 and 2048 pixels.","title":"Image Size","examples":[{"height":1152,"width":2016}]},"acceleration":{"enum":["none","regular","high"],"description":"The acceleration level to use for the image generation.","type":"string","title":"Acceleration","examples":["regular"],"default":"regular"},"enable_safety_checker":{"description":"If set to true, the safety checker will be enabled.","type":"boolean","title":"Enable Safety Checker","default":true},"output_format":{"enum":["jpeg","png","webp"],"description":"The format of the generated image.","type":"string","title":"Output Format","default":"png"},"sync_mode":{"description":"If `True`, the media will be returned as a data URI and the output data won't be available in the request history.","type":"boolean","title":"Sync Mode","default":false},"guidance_scale":{"minimum":0,"description":"Guidance Scale is a measure of how close you want the model to stick to your prompt when looking for a related image to show you.","type":"number","title":"Guidance Scale","maximum":20,"default":2.5},"seed":{"description":"The seed to use for the generation. If not provided, a random seed will be used.","type":"integer","title":"Seed"},"image_urls":{"examples":[["https://storage.googleapis.com/falserverless/example_inputs/flux2_dev_edit_input.png"]],"description":"The URLs of the images for editing. A maximum of 4 images are allowed, if more are provided, only the first 4 will be used.","type":"array","title":"Image URLs","items":{"type":"string"}},"enable_prompt_expansion":{"description":"If set to true, the prompt will be expanded for better results.","type":"boolean","title":"Enable Prompt Expansion","default":false},"num_inference_steps":{"minimum":4,"description":"The number of inference steps to perform.","type":"integer","title":"Number of Inference Steps","maximum":50,"default":28}},"title":"Flux2EditImageInput","required":["prompt","image_urls"]},"Flux2EditOutput":{"x-fal-order-properties":["images","timings","seed","has_nsfw_concepts","prompt"],"type":"object","properties":{"prompt":{"description":"The prompt used for generating the image.","type":"string","title":"Prompt"},"images":{"examples":[[{"url":"https://storage.googleapis.com/falserverless/example_outputs/flux2_dev_edit_output.png"}]],"description":"The edited images","type":"array","title":"Images","items":{"$ref":"#/components/schemas/ImageFile"}},"seed":{"description":"\n Seed of the generated Image. It will be the same value of the one passed in the\n input or the randomly generated that was used in case none was passed.\n ","type":"integer","title":"Seed"},"has_nsfw_concepts":{"description":"Whether the generated images contain NSFW concepts.","type":"array","title":"Has Nsfw Concepts","items":{"type":"boolean"}},"timings":{"title":"Timings","type":"object","additionalProperties":{"type":"number"}}},"title":"Flux2EditImageOutput","required":["images","timings","seed","has_nsfw_concepts","prompt"]},"ImageSize":{"x-fal-order-properties":["width","height"],"type":"object","properties":{"height":{"description":"The height of the generated image.","type":"integer","title":"Height","maximum":14142,"exclusiveMinimum":0,"default":512},"width":{"description":"The width of the generated image.","type":"integer","title":"Width","maximum":14142,"exclusiveMinimum":0,"default":512}},"title":"ImageSize"},"ImageFile":{"x-fal-order-properties":["url","content_type","file_name","file_size","file_data","width","height"],"type":"object","properties":{"file_size":{"examples":[4404019],"description":"The size of the file in bytes.","type":"integer","title":"File Size"},"height":{"description":"The height of the image","type":"integer","title":"Height"},"url":{"description":"The URL where the file can be downloaded from.","type":"string","title":"Url"},"width":{"description":"The width of the image","type":"integer","title":"Width"},"file_name":{"examples":["z9RV14K95DvU.png"],"description":"The name of the file. It will be auto-generated if not provided.","type":"string","title":"File Name"},"content_type":{"examples":["image/png"],"description":"The mime type of the file.","type":"string","title":"Content Type"},"file_data":{"format":"binary","title":"File Data","type":"string","description":"File data"}},"title":"ImageFile","required":["url"]}}},"paths":{"/fal-ai/flux-2/edit/requests/{request_id}/status":{"get":{"parameters":[{"name":"request_id","in":"path","required":true,"schema":{"type":"string","description":"Request ID"}},{"name":"logs","in":"query","required":false,"schema":{"type":"number","description":"Whether to include logs (`1`) in the response or not (`0`)."}}],"responses":{"200":{"description":"The request status.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QueueStatus"}}}}}}},"/fal-ai/flux-2/edit/requests/{request_id}/cancel":{"put":{"parameters":[{"name":"request_id","in":"path","required":true,"schema":{"type":"string","description":"Request ID"}}],"responses":{"200":{"description":"The request was cancelled.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"Whether the request was cancelled successfully."}}}}}}}}},"/fal-ai/flux-2/edit":{"post":{"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Flux2EditInput"}}}},"responses":{"200":{"description":"The request status.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QueueStatus"}}}}}}},"/fal-ai/flux-2/edit/requests/{request_id}":{"get":{"parameters":[{"name":"request_id","in":"path","required":true,"schema":{"type":"string","description":"Request ID"}}],"responses":{"200":{"description":"Result of the request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Flux2EditOutput"}}}}}}}},"servers":[{"url":"https://queue.fal.run"}],"security":[{"apiKeyAuth":[]}]}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"openapi":"3.0.4","info":{"title":"Queue OpenAPI for fal-ai/flux-2/flash/edit","version":"1.0.0","description":"The OpenAPI schema for the fal-ai/flux-2/flash/edit queue.","x-fal-metadata":{"endpointId":"fal-ai/flux-2/flash/edit","category":"image-to-image","thumbnailUrl":"https://v3b.fal.media/files/b/0a871484/fjLSktGKoWIGQWm-GRaUM_87cd94bbbff7400b830e73b8f6f075d4.jpg","playgroundUrl":"https://fal.ai/models/fal-ai/flux-2/flash/edit","documentationUrl":"https://fal.ai/models/fal-ai/flux-2/flash/edit/api"}},"components":{"securitySchemes":{"apiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Fal Key"}},"schemas":{"QueueStatus":{"type":"object","properties":{"status":{"type":"string","enum":["IN_QUEUE","IN_PROGRESS","COMPLETED"]},"request_id":{"type":"string","description":"The request id."},"response_url":{"type":"string","description":"The response url."},"status_url":{"type":"string","description":"The status url."},"cancel_url":{"type":"string","description":"The cancel url."},"logs":{"type":"object","description":"The logs.","additionalProperties":true},"metrics":{"type":"object","description":"The metrics.","additionalProperties":true},"queue_position":{"type":"integer","description":"The queue position."}},"required":["status","request_id"]},"Flux2FlashEditInput":{"x-fal-order-properties":["prompt","guidance_scale","seed","image_size","num_images","enable_prompt_expansion","sync_mode","enable_safety_checker","output_format","image_urls"],"type":"object","properties":{"prompt":{"examples":["Remove the meat from the hamburger"],"description":"The prompt to edit the image.","type":"string","title":"Prompt"},"num_images":{"minimum":1,"description":"The number of images to generate.","type":"integer","title":"Number of Images","maximum":4,"default":1},"image_size":{"anyOf":[{"$ref":"#/components/schemas/ImageSize"},{"enum":["square_hd","square","portrait_4_3","portrait_16_9","landscape_4_3","landscape_16_9"],"type":"string"}],"description":"The size of the image to generate. The width and height must be between 512 and 2048 pixels.","title":"Image Size","default":"square_hd"},"output_format":{"enum":["jpeg","png","webp"],"description":"The format of the generated image.","type":"string","title":"Output Format","default":"png"},"sync_mode":{"description":"If `True`, the media will be returned as a data URI and the output data won't be available in the request history.","type":"boolean","title":"Sync Mode","default":false},"guidance_scale":{"minimum":0,"description":"Guidance Scale is a measure of how close you want the model to stick to your prompt when looking for a related image to show you.","type":"number","title":"Guidance Scale","maximum":20,"default":2.5},"seed":{"description":"The seed to use for the generation. If not provided, a random seed will be used.","type":"integer","title":"Seed"},"image_urls":{"examples":[["https://storage.googleapis.com/falserverless/example_outputs/flux-2-flash-edit-input.png"]],"description":"The URLs of the images for editing. A maximum of 4 images are allowed, if more are provided, only the first 4 will be used.","type":"array","title":"Image URLs","items":{"type":"string"}},"enable_prompt_expansion":{"description":"If set to true, the prompt will be expanded for better results.","type":"boolean","title":"Enable Prompt Expansion","default":false},"enable_safety_checker":{"description":"If set to true, the safety checker will be enabled.","type":"boolean","title":"Enable Safety Checker","default":true}},"title":"Flux2FlashEditImageInput","required":["prompt","image_urls"]},"Flux2FlashEditOutput":{"x-fal-order-properties":["images","timings","seed","has_nsfw_concepts","prompt"],"type":"object","properties":{"prompt":{"description":"The prompt used for generating the image.","type":"string","title":"Prompt"},"images":{"examples":[[{"url":"https://storage.googleapis.com/falserverless/example_outputs/flux-2-flash-edit.png"}]],"description":"The edited images","type":"array","title":"Images","items":{"$ref":"#/components/schemas/ImageFile"}},"seed":{"description":"\n Seed of the generated Image. It will be the same value of the one passed in the\n input or the randomly generated that was used in case none was passed.\n ","type":"integer","title":"Seed"},"has_nsfw_concepts":{"description":"Whether the generated images contain NSFW concepts.","type":"array","title":"Has Nsfw Concepts","items":{"type":"boolean"}},"timings":{"title":"Timings","type":"object","additionalProperties":{"type":"number"}}},"title":"Flux2FlashEditImageOutput","required":["images","timings","seed","has_nsfw_concepts","prompt"]},"ImageSize":{"x-fal-order-properties":["width","height"],"type":"object","properties":{"height":{"description":"The height of the generated image.","type":"integer","title":"Height","maximum":14142,"exclusiveMinimum":0,"default":512},"width":{"description":"The width of the generated image.","type":"integer","title":"Width","maximum":14142,"exclusiveMinimum":0,"default":512}},"title":"ImageSize"},"ImageFile":{"x-fal-order-properties":["url","content_type","file_name","file_size","file_data","width","height"],"type":"object","properties":{"file_size":{"examples":[4404019],"description":"The size of the file in bytes.","type":"integer","title":"File Size"},"height":{"description":"The height of the image","type":"integer","title":"Height"},"url":{"description":"The URL where the file can be downloaded from.","type":"string","title":"Url"},"width":{"description":"The width of the image","type":"integer","title":"Width"},"file_name":{"examples":["z9RV14K95DvU.png"],"description":"The name of the file. It will be auto-generated if not provided.","type":"string","title":"File Name"},"content_type":{"examples":["image/png"],"description":"The mime type of the file.","type":"string","title":"Content Type"},"file_data":{"format":"binary","title":"File Data","type":"string","description":"File data"}},"title":"ImageFile","required":["url"]}}},"paths":{"/fal-ai/flux-2/flash/edit/requests/{request_id}/status":{"get":{"parameters":[{"name":"request_id","in":"path","required":true,"schema":{"type":"string","description":"Request ID"}},{"name":"logs","in":"query","required":false,"schema":{"type":"number","description":"Whether to include logs (`1`) in the response or not (`0`)."}}],"responses":{"200":{"description":"The request status.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QueueStatus"}}}}}}},"/fal-ai/flux-2/flash/edit/requests/{request_id}/cancel":{"put":{"parameters":[{"name":"request_id","in":"path","required":true,"schema":{"type":"string","description":"Request ID"}}],"responses":{"200":{"description":"The request was cancelled.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"Whether the request was cancelled successfully."}}}}}}}}},"/fal-ai/flux-2/flash/edit":{"post":{"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Flux2FlashEditInput"}}}},"responses":{"200":{"description":"The request status.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QueueStatus"}}}}}}},"/fal-ai/flux-2/flash/edit/requests/{request_id}":{"get":{"parameters":[{"name":"request_id","in":"path","required":true,"schema":{"type":"string","description":"Request ID"}}],"responses":{"200":{"description":"Result of the request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Flux2FlashEditOutput"}}}}}}}},"servers":[{"url":"https://queue.fal.run"}],"security":[{"apiKeyAuth":[]}]}

0 commit comments

Comments
 (0)