https://github.com/sahapranta/laravel-assignment
https://github.com/sahapranta/laravel-assignment
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/sahapranta/laravel-assignment
- Owner: sahapranta
- Created: 2023-09-03T04:24:52.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-09-03T08:49:49.000Z (over 1 year ago)
- Last Synced: 2025-02-07T16:43:04.912Z (3 months ago)
- Language: PHP
- Size: 1.05 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Laravel Assignment
This is a simple assignment to use Filamentphp and openai api to generate image from the user given keyword.
### Screenshots
### Installation
- Clone this repo `git clone https://github.com/sahapranta/laravel_assignment` or download as zip file
```bash
composer installcp .env.example .env
php artisan key:generatephp artisan migrate
php artisan make:filament-user
php artisan serve# for the background job processing...
php artisan queue:work
```- Set the `OPENAI_API_KEY` at `.env`
- Visit: [http://localhost:8000/admin](http://localhost:8000/admin)
### Process flow
1. Add the Keyword of the Image
2. There is an Observer `ImageObserver.php` that listen for the created event
3. On created dispatch using Bus chaining two Jobs `GetPrompt` & `GenerateImage`
4. Get Prompt Job will get the prompt from OpenAi API based on the keywords added by User in step 1, then it will save into database5. Generate Image will call OpenAi Api based on the given prompt to create an image.
6. After getting the api response I am storing the image to Storage and saving the path to database
7. In the ImageResource I have added custom table field that fetch the latest data at every 10sec using wire:poll if the progress is not 100%