Skip to content

Instantly share code, notes, and snippets.

@CViniciusSDias
Created April 13, 2024 19:52
Show Gist options
  • Save CViniciusSDias/889343bfdf98a8eec9f2018b56e948c9 to your computer and use it in GitHub Desktop.
Save CViniciusSDias/889343bfdf98a8eec9f2018b56e948c9 to your computer and use it in GitHub Desktop.
TransformersPHP error
FROM php:8.3-cli
RUN apt update && apt install -y libffi-dev libz-dev libpng-dev git libzip-dev
RUN docker-php-ext-install ffi sockets gd pcntl zip
COPY --from=composer:2.5.8 /usr/bin/composer /usr/bin/composer
RUN composer require codewithkyrian/transformers
RUN ./vendor/bin/transformers install
COPY transformers.php .
CMD ["php", "transformers.php"]
<?php
use function Codewithkyrian\Transformers\Pipelines\pipeline;
require 'vendor/autoload.php';
$classifier = pipeline('sentiment-analysis');
var_dump($classifier('I love TransformersPHP!'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment