Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

1015 B
Raw Blame
import { IconButton } from '@invoke-ai/ui-library';
import { useImageUploadButton } from 'common/hooks/useImageUploadButton';
import { t } from 'i18next';
import { memo } from 'react';
import { PiUploadBold } from 'react-icons/pi';

// The gallery uploader is the one place videos are accepted — every other consumer wants an image.
const UPLOAD_OPTIONS: Parameters<typeof useImageUploadButton>[0] = { allowMultiple: true, allowVideos: true };

export const GalleryUploadButton = memo(() => {
  const uploadApi = useImageUploadButton(UPLOAD_OPTIONS);
  return (
    <>
      <IconButton
        size="sm"
        alignSelf="stretch"
        variant="link"
        aria-label={t('accessibility.uploadMedia')}
        tooltip={t('accessibility.uploadMedia')}
        icon={<PiUploadBold />}
        isLoading={uploadApi.isUploading}
        {...uploadApi.getUploadButtonProps()}
      />
      <input {...uploadApi.getUploadInputProps()} />
    </>
  );
});
GalleryUploadButton.displayName = 'GalleryUploadButton';