Create a single file application using HTML + JS and implement all functions from this…
- User
Create a single file application using HTML + JS and implement all functions from this API: Choose a language to see the code snippets for interacting with the API.
Install the python client (docs) if you don't already have it installed. copy $ pip install gradio_client 2. Find the API endpoint below corresponding to your desired function in the app. Copy the code snippet, replacing the placeholder values with your own input data. If this is a private Space, you may need to pass your Hugging Face token as well (read more). Or use the API Recorder
to automatically generate your API requests.
api_name: /generate copy from gradio_client import Client, handle_file
client = Client("multimodalart/logo-in-context") result = client.predict( image=handle_file('https://raw.githubusercontent.com/gradio-app/gradio/main/test/test_files/bus.png'), prompt_description="Hello!!", prompt_user="Hello!!", api_name="/generate" ) print(result) Accepts 3 parameters: image Dict(path: str | None (Path to a local file), url: str | None (Publicly available url or base64 encoded image), size: int | None (Size of image in bytes), orig_name: str | None (Original filename), mime_type: str | None (mime type of image), is_stream: bool (Can always be set to False), meta: Dict()) Required
The input value that is provided in the "Upload Logo Image" Image component. For input, either path or url must be provided. For output, path is always provided.
prompt_description str Required
The input value that is provided in the "Describe your logo" Textbox component.
prompt_user str Required
The input value that is provided in the "Where should the logo be applied?" Textbox component.
Returns tuple of 2 elements [0] Dict(path: str | None (Path to a local file), url: str | None (Publicly available url or base64 encoded image), size: int | None (Size of image in bytes), orig_name: str | None (Original filename), mime_type: str | None (mime type of image), is_stream: bool (Can always be set to False), meta: Dict())
The output value that appears in the "Generated Application" Image component.
[1] Dict(path: str | None (Path to a local file), url: str | None (Publicly available url or base64 encoded image), size: int | None (Size of image in bytes), orig_name: str | None (Original filename), mime_type: str | None (mime type of image), is_stream: bool (Can always be set to False), meta: Dict())
The output value that appears in the "Side by side" Image component.
- Assistant