diff --git a/openai_product_images/README.rst b/openai_product_images/README.rst new file mode 100644 index 000000000..89c280fa8 --- /dev/null +++ b/openai_product_images/README.rst @@ -0,0 +1,41 @@ +OpenAI Product Images +========== +* Module which helps search image and save that image to product media in ecommerce on the basis of product prompt + +Installation +============ + - www.odoo.com/documentation/16.0/setup/install.html + - Install our custom addon + +License +------- +General Public License, Version 3 (AGPL v3). +(https://www.odoo.com/documentation/user/16.0/legal/licenses/licenses.html) + +Company +------- +* `Cybrosys Techno Solutions `__ + +Credits +------- +* Developer: +Ranjith R @ cybrosys + +Contacts +-------- +* Mail Contact : odoo@cybrosys.com + +Bug Tracker +----------- +Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. + +Maintainer +========== +This module is maintained by Cybrosys Technologies. + +For support and more information, please visit https://www.cybrosys.com + +Further information +=================== +HTML Description: ``__ + diff --git a/openai_product_images/__init__.py b/openai_product_images/__init__.py new file mode 100644 index 000000000..4107edee8 --- /dev/null +++ b/openai_product_images/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Ranjith R (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +################################################################################ +from . import models +from . import wizard diff --git a/openai_product_images/__manifest__.py b/openai_product_images/__manifest__.py new file mode 100644 index 000000000..bb38dfd55 --- /dev/null +++ b/openai_product_images/__manifest__.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Ranjith R (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +################################################################################ +{ + 'name': 'Generate Product Images Using OpenAI', + 'version': '16.0.1.0.0', + 'category': 'Extra Tools', + 'summary': 'This module helps to generate images for products using DALL-E.', + 'description': 'Odoo Module for Generating Product Images using DALL-E', + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'images': ['static/description/banner.png,static/description/banner.png'], + 'website': 'https://www.cybrosys.com', + 'depends': ['base', 'product', 'openai_odoo_base','sale'], + 'data': [ + 'security/ir.model.access.csv', + 'views/product_template_views.xml', + 'views/dalle_image_suggestion.xml', + 'wizard/image_suggestion_views.xml', + ], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/openai_product_images/doc/RELEASE_NOTES.md b/openai_product_images/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..79e3da6f3 --- /dev/null +++ b/openai_product_images/doc/RELEASE_NOTES.md @@ -0,0 +1,7 @@ +## Module + +#### 17.03.2023 +#### Version 16.0.1.0.0 +#### ADD +- Initial commit for OpenAI Product Images + diff --git a/openai_product_images/models/__init__.py b/openai_product_images/models/__init__.py new file mode 100644 index 000000000..a9e10d68d --- /dev/null +++ b/openai_product_images/models/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Ranjith R (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +################################################################################ +from . import dalle_image_suggestion +from . import product_template diff --git a/openai_product_images/models/dalle_image_suggestion.py b/openai_product_images/models/dalle_image_suggestion.py new file mode 100644 index 000000000..2db457bc7 --- /dev/null +++ b/openai_product_images/models/dalle_image_suggestion.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Ranjith R (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +################################################################################ +from odoo import fields, models + + +class DalleImageSuggestion(models.Model): + """image for product from dalle and save it as record""" + _name = 'dalle.image.suggestion' + _rec_name = 'product_tmpl_id' + _description = 'model for save image' + + product_image = fields.Binary('Image', attachment=True, + help="filed to store image") + product_tmpl_id = fields.Many2one('product.template', 'Related Product', + help="filed to store product") + + def action_make_as_product_image(self): + """Summary: + Function to make this image as product image + Returns: + returns the product form view image of corresponding product + """ + + self.product_tmpl_id.image_1920 = self.product_image + return { + 'name': self.product_tmpl_id.name, + 'view_mode': 'form', + 'res_model': 'product.template', + 'type': 'ir.actions.act_window', + 'res_id': self.product_tmpl_id.id, + 'domain': [('id', '=', self.product_tmpl_id.id)], + 'target': 'current', + } diff --git a/openai_product_images/models/product_template.py b/openai_product_images/models/product_template.py new file mode 100644 index 000000000..20094acd3 --- /dev/null +++ b/openai_product_images/models/product_template.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Ranjith R (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +################################################################################ +from odoo import models + + +class ProductTemplate(models.Model): + """To write function for product template buttons """ + + _inherit = 'product.template' + + def action_open_image_prompt_wizard(self): + """Summary: + Function to view image suggestion + Returns: + returns the image of corresponding product + """ + + return { + 'name': self.name, + 'view_mode': 'form', + 'res_model': 'image.suggestion', + 'type': 'ir.actions.act_window', + 'target': 'new', + 'context': {'default_product_tmpl_id': self.id}, + } + + def get_dall_e_image(self): + """Summary: + Function to view dalle image suggestion + Returns: + returns the created image of corresponding product + """ + + return { + 'name': self.name, + 'view_mode': 'tree,form', + 'res_model': 'dalle.image.suggestion', + 'type': 'ir.actions.act_window', + 'domain': [('product_tmpl_id', '=', self.id)], + } diff --git a/openai_product_images/security/ir.model.access.csv b/openai_product_images/security/ir.model.access.csv new file mode 100644 index 000000000..99e65b51d --- /dev/null +++ b/openai_product_images/security/ir.model.access.csv @@ -0,0 +1,3 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_dalle_image_suggestion,access.dalle.image.suggestion,model_dalle_image_suggestion,base.group_user,1,1,1,1 +access_image_suggestion,access.image.suggestion,model_image_suggestion,base.group_user,1,1,1,1 \ No newline at end of file diff --git a/openai_product_images/static/description/assets/icons/check.png b/openai_product_images/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/openai_product_images/static/description/assets/icons/check.png differ diff --git a/openai_product_images/static/description/assets/icons/chevron.png b/openai_product_images/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/openai_product_images/static/description/assets/icons/chevron.png differ diff --git a/openai_product_images/static/description/assets/icons/cogs.png b/openai_product_images/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/openai_product_images/static/description/assets/icons/cogs.png differ diff --git a/openai_product_images/static/description/assets/icons/consultation.png b/openai_product_images/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/openai_product_images/static/description/assets/icons/consultation.png differ diff --git a/openai_product_images/static/description/assets/icons/ecom-black.png b/openai_product_images/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/openai_product_images/static/description/assets/icons/ecom-black.png differ diff --git a/openai_product_images/static/description/assets/icons/education-black.png b/openai_product_images/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/openai_product_images/static/description/assets/icons/education-black.png differ diff --git a/openai_product_images/static/description/assets/icons/hotel-black.png b/openai_product_images/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/openai_product_images/static/description/assets/icons/hotel-black.png differ diff --git a/openai_product_images/static/description/assets/icons/license.png b/openai_product_images/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/openai_product_images/static/description/assets/icons/license.png differ diff --git a/openai_product_images/static/description/assets/icons/lifebuoy.png b/openai_product_images/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/openai_product_images/static/description/assets/icons/lifebuoy.png differ diff --git a/openai_product_images/static/description/assets/icons/manufacturing-black.png b/openai_product_images/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/openai_product_images/static/description/assets/icons/manufacturing-black.png differ diff --git a/openai_product_images/static/description/assets/icons/pos-black.png b/openai_product_images/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/openai_product_images/static/description/assets/icons/pos-black.png differ diff --git a/openai_product_images/static/description/assets/icons/puzzle.png b/openai_product_images/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/openai_product_images/static/description/assets/icons/puzzle.png differ diff --git a/openai_product_images/static/description/assets/icons/restaurant-black.png b/openai_product_images/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/openai_product_images/static/description/assets/icons/restaurant-black.png differ diff --git a/openai_product_images/static/description/assets/icons/service-black.png b/openai_product_images/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/openai_product_images/static/description/assets/icons/service-black.png differ diff --git a/openai_product_images/static/description/assets/icons/trading-black.png b/openai_product_images/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/openai_product_images/static/description/assets/icons/trading-black.png differ diff --git a/openai_product_images/static/description/assets/icons/training.png b/openai_product_images/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/openai_product_images/static/description/assets/icons/training.png differ diff --git a/openai_product_images/static/description/assets/icons/update.png b/openai_product_images/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/openai_product_images/static/description/assets/icons/update.png differ diff --git a/openai_product_images/static/description/assets/icons/user.png b/openai_product_images/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/openai_product_images/static/description/assets/icons/user.png differ diff --git a/openai_product_images/static/description/assets/icons/wrench.png b/openai_product_images/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/openai_product_images/static/description/assets/icons/wrench.png differ diff --git a/openai_product_images/static/description/assets/misc/categories.png b/openai_product_images/static/description/assets/misc/categories.png new file mode 100644 index 000000000..bedf1e0b1 Binary files /dev/null and b/openai_product_images/static/description/assets/misc/categories.png differ diff --git a/openai_product_images/static/description/assets/misc/check-box.png b/openai_product_images/static/description/assets/misc/check-box.png new file mode 100644 index 000000000..42caf24b9 Binary files /dev/null and b/openai_product_images/static/description/assets/misc/check-box.png differ diff --git a/openai_product_images/static/description/assets/misc/compass.png b/openai_product_images/static/description/assets/misc/compass.png new file mode 100644 index 000000000..d5fed8faa Binary files /dev/null and b/openai_product_images/static/description/assets/misc/compass.png differ diff --git a/openai_product_images/static/description/assets/misc/corporate.png b/openai_product_images/static/description/assets/misc/corporate.png new file mode 100644 index 000000000..2eb13edbf Binary files /dev/null and b/openai_product_images/static/description/assets/misc/corporate.png differ diff --git a/openai_product_images/static/description/assets/misc/customer-support.png b/openai_product_images/static/description/assets/misc/customer-support.png new file mode 100644 index 000000000..79efc72ed Binary files /dev/null and b/openai_product_images/static/description/assets/misc/customer-support.png differ diff --git a/openai_product_images/static/description/assets/misc/cybrosys-logo.png b/openai_product_images/static/description/assets/misc/cybrosys-logo.png new file mode 100644 index 000000000..cc3cc0ccf Binary files /dev/null and b/openai_product_images/static/description/assets/misc/cybrosys-logo.png differ diff --git a/openai_product_images/static/description/assets/misc/features.png b/openai_product_images/static/description/assets/misc/features.png new file mode 100644 index 000000000..b41769f77 Binary files /dev/null and b/openai_product_images/static/description/assets/misc/features.png differ diff --git a/openai_product_images/static/description/assets/misc/logo.png b/openai_product_images/static/description/assets/misc/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/openai_product_images/static/description/assets/misc/logo.png differ diff --git a/openai_product_images/static/description/assets/misc/pictures.png b/openai_product_images/static/description/assets/misc/pictures.png new file mode 100644 index 000000000..56d255fe9 Binary files /dev/null and b/openai_product_images/static/description/assets/misc/pictures.png differ diff --git a/openai_product_images/static/description/assets/misc/pie-chart.png b/openai_product_images/static/description/assets/misc/pie-chart.png new file mode 100644 index 000000000..426e05244 Binary files /dev/null and b/openai_product_images/static/description/assets/misc/pie-chart.png differ diff --git a/openai_product_images/static/description/assets/misc/right-arrow.png b/openai_product_images/static/description/assets/misc/right-arrow.png new file mode 100644 index 000000000..730984a06 Binary files /dev/null and b/openai_product_images/static/description/assets/misc/right-arrow.png differ diff --git a/openai_product_images/static/description/assets/misc/star.png b/openai_product_images/static/description/assets/misc/star.png new file mode 100644 index 000000000..2eb9ab29f Binary files /dev/null and b/openai_product_images/static/description/assets/misc/star.png differ diff --git a/openai_product_images/static/description/assets/misc/support.png b/openai_product_images/static/description/assets/misc/support.png new file mode 100644 index 000000000..4f18b8b82 Binary files /dev/null and b/openai_product_images/static/description/assets/misc/support.png differ diff --git a/openai_product_images/static/description/assets/misc/whatsapp.png b/openai_product_images/static/description/assets/misc/whatsapp.png new file mode 100644 index 000000000..d513a5356 Binary files /dev/null and b/openai_product_images/static/description/assets/misc/whatsapp.png differ diff --git a/openai_product_images/static/description/assets/modules/1.png b/openai_product_images/static/description/assets/modules/1.png new file mode 100644 index 000000000..5238bdeab Binary files /dev/null and b/openai_product_images/static/description/assets/modules/1.png differ diff --git a/openai_product_images/static/description/assets/modules/2.png b/openai_product_images/static/description/assets/modules/2.png new file mode 100644 index 000000000..1ae7cfe3b Binary files /dev/null and b/openai_product_images/static/description/assets/modules/2.png differ diff --git a/openai_product_images/static/description/assets/modules/3.png b/openai_product_images/static/description/assets/modules/3.png new file mode 100644 index 000000000..3c3ff1afb Binary files /dev/null and b/openai_product_images/static/description/assets/modules/3.png differ diff --git a/openai_product_images/static/description/assets/modules/4.png b/openai_product_images/static/description/assets/modules/4.png new file mode 100644 index 000000000..3fae4631e Binary files /dev/null and b/openai_product_images/static/description/assets/modules/4.png differ diff --git a/openai_product_images/static/description/assets/modules/5.gif b/openai_product_images/static/description/assets/modules/5.gif new file mode 100644 index 000000000..2a5f8e659 Binary files /dev/null and b/openai_product_images/static/description/assets/modules/5.gif differ diff --git a/openai_product_images/static/description/assets/modules/6.png b/openai_product_images/static/description/assets/modules/6.png new file mode 100644 index 000000000..7f2815273 Binary files /dev/null and b/openai_product_images/static/description/assets/modules/6.png differ diff --git a/openai_product_images/static/description/assets/screenshots/1.png b/openai_product_images/static/description/assets/screenshots/1.png new file mode 100644 index 000000000..abaf9e13e Binary files /dev/null and b/openai_product_images/static/description/assets/screenshots/1.png differ diff --git a/openai_product_images/static/description/assets/screenshots/2.png b/openai_product_images/static/description/assets/screenshots/2.png new file mode 100644 index 000000000..a43f1215d Binary files /dev/null and b/openai_product_images/static/description/assets/screenshots/2.png differ diff --git a/openai_product_images/static/description/assets/screenshots/3.png b/openai_product_images/static/description/assets/screenshots/3.png new file mode 100644 index 000000000..cc444be34 Binary files /dev/null and b/openai_product_images/static/description/assets/screenshots/3.png differ diff --git a/openai_product_images/static/description/assets/screenshots/4.png b/openai_product_images/static/description/assets/screenshots/4.png new file mode 100644 index 000000000..25aa2c104 Binary files /dev/null and b/openai_product_images/static/description/assets/screenshots/4.png differ diff --git a/openai_product_images/static/description/assets/screenshots/5.png b/openai_product_images/static/description/assets/screenshots/5.png new file mode 100644 index 000000000..5e5794ca8 Binary files /dev/null and b/openai_product_images/static/description/assets/screenshots/5.png differ diff --git a/openai_product_images/static/description/assets/screenshots/hero.gif b/openai_product_images/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..de1026d35 Binary files /dev/null and b/openai_product_images/static/description/assets/screenshots/hero.gif differ diff --git a/openai_product_images/static/description/assets/screenshots/settings.png b/openai_product_images/static/description/assets/screenshots/settings.png new file mode 100644 index 000000000..e9f214774 Binary files /dev/null and b/openai_product_images/static/description/assets/screenshots/settings.png differ diff --git a/openai_product_images/static/description/banner.png b/openai_product_images/static/description/banner.png new file mode 100644 index 000000000..e0b0ed118 Binary files /dev/null and b/openai_product_images/static/description/banner.png differ diff --git a/openai_product_images/static/description/icon.png b/openai_product_images/static/description/icon.png new file mode 100644 index 000000000..ac0dbf9d9 Binary files /dev/null and b/openai_product_images/static/description/icon.png differ diff --git a/openai_product_images/static/description/index.html b/openai_product_images/static/description/index.html new file mode 100644 index 000000000..9c07a8705 --- /dev/null +++ b/openai_product_images/static/description/index.html @@ -0,0 +1,577 @@ +
+ +
+ +
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+ +
+
+
+ +

+ Generate Product Images Using OpenAI

+

Odoo Module for + Generating Product Images using DALL-E

+ +
+
+
+ + +
+ + +
+
+ +
+

Explore This + Module

+
+ + + + +
+
+ +
+

Overview +

+
+
+
+ This Odoo module allows you to generate product images on the basis of prompts using DALL-E, a deep learning + model developed by OpenAI. With this module, you can quickly and easily create high-quality product images that + are customized to your specific needs, without the need for expensive photography equipment or graphic design + software. Simply enter a prompt, such as "red t-shirt with white stripes", and the module will use DALL-E to + generate a unique product image that matches your description. This can be especially useful for e-commerce + websites, where high-quality product images can help to increase sales and customer engagement. +
+
+ + + +
+
+ +
+

Features +

+
+
+
+
+ + Community & + Enterprise Support. +
+
+ + Picture sample searching for product +
+
+
+ + Available in Odoo 16.0 + Community and Enterprise. +
+
+
+ + Convert the pictures to product image +
+ +
+
+ + + +
+
+ +
+

Screenshots +

+
+
+
+
+

+ Field to Fill API Key +

+

+ Fill your API key in settings for easy accessibility of api key

+ +
+
+
+
+

+ Searching the product image +

+

+ Searching the product image through a wizard by filling prompt, size and number

+ +

+ +

+
+
+
+

+ Sample picture record +

+

Creates collection of + image

+ +

+
+
+

+ Convert to product image +

+

Convert one of that image + to product image

+
+ +

+
+
+ + + + +
+
+ +
+

Related + Products +

+
+
+
+ +
+
+ + + + +
+
+ +
+

Our Services +

+
+ +
+
+
+
+ +
+
+ Odoo + Customization
+
+ +
+
+ +
+
+ Odoo + Implementation
+
+ +
+
+ +
+
+ Odoo + Support
+
+ + +
+
+ +
+
+ Hire + Odoo + Developer
+
+ +
+
+ +
+
+ Odoo + Integration
+
+ +
+
+ +
+
+ Odoo + Migration
+
+ + +
+
+ +
+
+ Odoo + Consultancy
+
+ +
+
+ +
+
+ Odoo + Implementation
+
+ +
+
+ +
+
+ Odoo + Licensing Consultancy
+
+
+ +
+ + + + + +
+
+ +
+

Our + Industries +

+
+ +
+
+
+
+ +
+ Trading +
+

+ Easily procure + and + sell your products

+
+
+ +
+
+ +
+ POS +
+

+ Easy + configuration + and convivial experience

+
+
+ +
+
+ +
+ Education +
+

+ A platform for + educational management

+
+
+ +
+
+ +
+ Manufacturing +
+

+ Plan, track and + schedule your operations

+
+
+ +
+
+ +
+ E-commerce & Website +
+

+ Mobile + friendly, + awe-inspiring product pages

+
+
+ +
+
+ +
+ Service Management +
+

+ Keep track of + services and invoice

+
+
+ +
+
+ +
+ Restaurant +
+

+ Run your bar or + restaurant methodically

+
+
+ +
+
+ +
+ Hotel Management +
+

+ An + all-inclusive + hotel management application

+
+
+
+
+ + + + +
+
+ +
+

Support +

+
+
+
+
+
+
+ +
+
+

Need Help?

+

Got questions or need help? Get in touch.

+ +

+ odoo@cybrosys.com

+
+
+
+
+
+
+
+ +
+
+

WhatsApp

+

Say hi to us on WhatsApp!

+ +

+91 86068 + 27707

+
+
+
+
+
+
+
+ +
+
+
+ \ No newline at end of file diff --git a/openai_product_images/views/dalle_image_suggestion.xml b/openai_product_images/views/dalle_image_suggestion.xml new file mode 100644 index 000000000..8849b2cc6 --- /dev/null +++ b/openai_product_images/views/dalle_image_suggestion.xml @@ -0,0 +1,43 @@ + + + + + dalle.image.suggestion.form.view + dalle.image.suggestion + +
+
+
+ +
+
+ + + + + +
+
+
+
+ + + openai_product_images.dalle_image_suggestion.tree + + dalle.image.suggestion + + + + + + + +
+
\ No newline at end of file diff --git a/openai_product_images/views/product_template_views.xml b/openai_product_images/views/product_template_views.xml new file mode 100644 index 000000000..f8aba2df8 --- /dev/null +++ b/openai_product_images/views/product_template_views.xml @@ -0,0 +1,28 @@ + + + + + Generate Image Using Dall-E + + + list,form + code + action =records.action_open_image_prompt_wizard() + + + + + product.template + +
+ +
+
+
+
+
\ No newline at end of file diff --git a/openai_product_images/wizard/__init__.py b/openai_product_images/wizard/__init__.py new file mode 100644 index 000000000..e4f36c388 --- /dev/null +++ b/openai_product_images/wizard/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Ranjith R (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +################################################################################ +from . import image_suggestion diff --git a/openai_product_images/wizard/image_suggestion.py b/openai_product_images/wizard/image_suggestion.py new file mode 100644 index 000000000..e3a4d1c13 --- /dev/null +++ b/openai_product_images/wizard/image_suggestion.py @@ -0,0 +1,90 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Ranjith R (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +################################################################################ +from odoo import fields, models +import requests +from requests.structures import CaseInsensitiveDict +import json +import base64 + +from odoo.exceptions import ValidationError + + +class ImageSuggestion(models.TransientModel): + """image for product from dalle""" + _name = 'image.suggestion' + _rec_name = 'product_tmpl_id' + _description = 'model for creation of dalle image ' + + image_prompt = fields.Char(string="Prompt for image", + help="field to fill prompt", required=True) + product_tmpl_id = fields.Many2one('product.template', string="Product", + help="field to store product", + required=True) + num_image = fields.Integer(string="Number of image needed", + help="field to store number of image", + required=True, + default=1) + size_image = fields.Selection( + [('256x256', '256x256'), ('512x512', '512x512')], string="Resolution", + help="field to store image size", required=True) + + def action_search(self): + """Summary: + Function to search image suggestion from dalle + Returns: + returns the created media image of corresponding product + """ + + api_key = self.env['ir.config_parameter'].sudo().get_param( + 'openai_api_key') + headers = CaseInsensitiveDict() + headers["Content-Type"] = "application/json" + headers["Authorization"] = f"Bearer {api_key}" + data = '{"model": "image-alpha-001",' \ + ' "prompt": "' + self.image_prompt + '", "num_images": ' +\ + str(self.num_image) + ', "size": "' \ + + self.size_image + '", "response_format": "url"}' + + resp = requests.post("https://api.openai.com/v1/images/generations", + headers=headers, data=data) + if resp.status_code != 200: + raise ValidationError("Failed to generate image") + response_text = json.loads(resp.text) + for url in response_text['data']: + image_url = url['url'] + # Get image data and encode it in base64 + image_resp = requests.get(image_url) + if image_resp.status_code != 200: + raise ValidationError("Failed to retrieve image") + image_b64 = base64.b64encode(image_resp.content) + # Store encoded image as binary field on model + self.env['dalle.image.suggestion'].create( + {'product_image': image_b64, + 'product_tmpl_id': self.product_tmpl_id.id, }) + return { + 'name': self.product_tmpl_id.name, + 'view_mode': 'tree,form', + 'res_model': 'dalle.image.suggestion', + 'type': 'ir.actions.act_window', + 'domain': [('product_tmpl_id', '=', self.product_tmpl_id.id)], + 'target': 'current', + } diff --git a/openai_product_images/wizard/image_suggestion_views.xml b/openai_product_images/wizard/image_suggestion_views.xml new file mode 100644 index 000000000..b3e84a685 --- /dev/null +++ b/openai_product_images/wizard/image_suggestion_views.xml @@ -0,0 +1,29 @@ + + + + + image.suggestion.form.view + image.suggestion + +
+ + + + + + + + + + + +
+
+
+
+
\ No newline at end of file