-
-
Notifications
You must be signed in to change notification settings - Fork 516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Concurrency #473
Comments
Doesn't work with <?php
use Spatie\Async\Pool;
require __DIR__ . '/vendor/autoload.php';
$input = [
"Sentence 1.",
"Sentence 2."
];
$pool = Pool::create();
$yourApiKey = 'get your own';
$client = OpenAI::client($yourApiKey);
foreach ($input as $index => $text) {
$pool->add(function () use ($client, $text, $index) {
$audio = $client->audio()->speech([
'model' => 'tts-1',
'input' => $text,
'voice' => 'alloy',
'response_format' => 'mp3',
]); // audio file content as string
file_put_contents("output_$index.mp3", $audio);
});
}
$pool->wait(); error
|
I would go with multi curl |
or dispatch laravel jobs, depends on your logic |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Aka how to do this for 10 different
input
s in the same time:The text was updated successfully, but these errors were encountered: