avatarChristopher Kokoski

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

6856

Abstract

edFileExtension = selectedFileName.split(‘.’).last; <span class="hljs-keyword">if</span>(allowedFormats != <span class="hljs-literal">null</span> || allowedFormats.isNotEmpty) { <span class="hljs-keyword">if</span>(!allowedFormats.contains(‘selectedFileExtension’)) { print(selectedFileName); message = ‘<span class="hljs-type">Selected</span> file format { selectedFileExtension } isn\’ allowed’; <span class="hljs-keyword">return</span> <span class="hljs-type">FilePickerWrapperFailedResult</span>(errorMessage: message,code: <span class="hljs-number">0</span>); } }

<span class="hljs-keyword">if</span> ( maxFileSizeAllowed < file.lengthSync() / <span class="hljs-number">1024</span>) { message = ‘<span class="hljs-type">File</span> size exceed, maximum file size allowed($maxFileSizeAllowed kB)’; <span class="hljs-keyword">return</span> <span class="hljs-type">FilePickerWrapperFailedResult</span>(errorMessage: message,code: <span class="hljs-number">0</span>); } <span class="hljs-keyword">return</span> <span class="hljs-type">FilePickerWrapperSuccessResult</span>(code: <span class="hljs-number">1</span>,filePath: file.path, fileName: selectedFileName); } }

<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">FilePickerWrapperResult</span> </span>{ int code; <span class="hljs-comment">// 1 means success result, 0 means failed or error result </span> }

<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">FilePickerWrapperSuccessResult</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">FilePickerWrapperResult</span> </span>{ <span class="hljs-type">FilePickerWrapperSuccessResult</span>({<span class="hljs-meta">@required</span> <span class="hljs-keyword">this</span>.filePath, <span class="hljs-meta">@required</span> <span class="hljs-keyword">this</span>.fileName, <span class="hljs-meta">@required</span> int code}) { <span class="hljs-keyword">this</span>.code = code; } <span class="hljs-type">String</span> filePath; <span class="hljs-type">String</span> fileName; }

<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">FilePickerWrapperFailedResult</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">FilePickerWrapperResult</span> </span>{ <span class="hljs-type">FilePickerWrapperFailedResult</span>({<span class="hljs-meta">@required</span> <span class="hljs-keyword">this</span>.errorMessage, <span class="hljs-meta">@required</span> int code}) { <span class="hljs-keyword">this</span>.code = code; } <span class="hljs-type">String</span> errorMessage; }</pre></div><p id="bb4a">In this helper class, we added functionality to select the image from the gallery app on the device. Now create a new file and name it <b>image_picker_wrapper.dart.</b></p><h1 id="c228">Enabling image selection</h1><p id="d038">Add the following code to this file:</p><div id="ef30"><pre>import ‘dart:io’; import ‘package:facerecognition/supporting_files/file_picker_wrapper.dart’; import ‘package:flutter/cupertino.dart’; import ‘package:flutter/material.dart’; import ‘package:image_picker/image_picker.dart’;

typedef ImagePickerResult = <span class="hljs-keyword">void</span> <span class="hljs-title function_ invoke__">Function</span>(FilePickerWrapperResult result);

<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">ImagePickerWrapper</span> </span>{ <span class="hljs-title function_ invoke__">ImagePickerWrapper</span>({ @required ImagePickerResult imagePickerResult, <span class="hljs-keyword">double</span> maxFileSizeAllowed = <span class="hljs-number">2024</span> //size in kb }) { this._imagePickerResult = imagePickerResult; this._maxFileSizeAllowed = maxFileSizeAllowed; } ImagePickerResult _imagePickerResult; <span class="hljs-keyword">double</span> _maxFileSizeAllowed;

<span class="hljs-keyword">void</span> <span class="hljs-title function_ invoke__">openImagePickerActionSheet</span>({@required BuildContext buildContext}) { <span class="hljs-keyword">if</span>(buildContext == <span class="hljs-literal">null</span>) { <span class="hljs-keyword">print</span>(‘build content can’’\’t be <span class="hljs-keyword">empty</span>’); <span class="hljs-keyword">return</span>; } <span class="hljs-keyword">if</span> (Platform.isIOS) { <span class="hljs-title function_ invoke__">_actionSheet</span>(buildContext); } <span class="hljs-keyword">else</span> { <span class="hljs-title function_ invoke__">_androidBottomSheet</span>(buildContext); } }

<span class="hljs-comment">//For ios </span> <span class="hljs-keyword">void</span> <span class="hljs-title function_ invoke__">_actionSheet</span>(BuildContext context) { _containerForSheet<String>( context: context, child: <span class="hljs-title function_ invoke__">CupertinoActionSheet</span>( <span class="hljs-attr">title</span>: <span class="hljs-title function_ invoke__">Text</span>(‘’), <span class="hljs-attr">message</span>: <span class="hljs-title function_ invoke__">Text</span>(‘’), <span class="hljs-attr">actions</span>: <Widget>[ <span class="hljs-title function_ invoke__">CupertinoActionSheetAction</span>( <span class="hljs-attr">child</span>: <span class="hljs-title function_ invoke__">Text</span>(‘Camera’), <span class="hljs-attr">onPressed</span>: () { <span class="hljs-title function_ invoke__">_openCamera</span>(ImageSource.camera); }, ), <span class="hljs-title function_ invoke__">CupertinoActionSheetAction</span>( <span class="hljs-attr">child</span>: <span class="hljs-title function_ invoke__">Text</span>(‘Gallery’), <span class="hljs-attr">onPressed</span>: () async { <span class="hljs-title function_ invoke__">_openFileExplorer</span>(); }, ), ], cancelButton: <span class="hljs-title function_ invoke__">CupertinoActionSheetAction</span>( <span class="hljs-attr">child</span>: <span class="hljs-title function_ invoke__">Text</span>(‘Cancel’), <span class="hljs-attr">isDefaultAction</span>: <span class="hljs-literal">true</span>, <span class="hljs-attr">onPressed</span>: () { Navigator.<span class="hljs-title function_ invoke__">pop</span>(context, ‘Cancel’); }, ))); }

<span class="hljs-keyword">void</span> _containerForSheet<T>({BuildContext context, Widget child}) { showCupertinoModalPopup<T>( context: context, builder: (BuildContext context) => child, ).then<<span class="hljs-keyword">void</span>>((T value) { }); }

<span class="hljs-comment">//For Android </span> <span class="hljs-keyword">void</span> <span class="hljs-title function_ invoke__">_androidBottomSheet</span>(BuildContext context) { show

Options

ModalBottomSheet<<span class="hljs-keyword">void</span>>( context: context, builder: (BuildContext context) { <span class="hljs-keyword">return</span> <span class="hljs-title function_ invoke__">Container</span>( <span class="hljs-attr">margin</span>: <span class="hljs-keyword">const</span> EdgeInsets.<span class="hljs-title function_ invoke__">only</span>(<span class="hljs-attr">left</span>: <span class="hljs-number">20.0</span>, <span class="hljs-attr">right</span>: <span class="hljs-number">20.0</span>), <span class="hljs-attr">child</span>: <span class="hljs-title function_ invoke__">Wrap</span>( <span class="hljs-attr">children</span>: <Widget>[ <span class="hljs-title function_ invoke__">ListTile</span>( <span class="hljs-attr">leading</span>: <span class="hljs-title function_ invoke__">Icon</span>(Icons.camera), <span class="hljs-attr">title</span>: <span class="hljs-title function_ invoke__">Text</span>(‘Camera’), <span class="hljs-attr">onTap</span>: () { <span class="hljs-title function_ invoke__">_openCamera</span>(ImageSource.camera); }), <span class="hljs-title function_ invoke__">ListTile</span>( <span class="hljs-attr">leading</span>: <span class="hljs-keyword">const</span> <span class="hljs-title function_ invoke__">Icon</span>(Icons.landscape), <span class="hljs-attr">title</span>: <span class="hljs-title function_ invoke__">Text</span>(‘Gallery’), <span class="hljs-attr">onTap</span>: () { // <span class="hljs-title function_ invoke__">_openFileExplorer</span>(); <span class="hljs-title function_ invoke__">_openCamera</span>(ImageSource.gallery); }, ), ], ), ); }); }

Future<<span class="hljs-keyword">void</span>> <span class="hljs-title function_ invoke__">_openCamera</span>(ImageSource source) async { File imageSelected = await ImagePicker.<span class="hljs-title function_ invoke__">pickImage</span>( <span class="hljs-attr">source</span>: source, <span class="hljs-attr">maxHeight</span>: <span class="hljs-number">400</span>, <span class="hljs-attr">maxWidth</span>: <span class="hljs-number">400</span>); <span class="hljs-keyword">if</span> (imageSelected != <span class="hljs-literal">null</span>) { <span class="hljs-keyword">final</span> String fileName = imageSelected.path.<span class="hljs-title function_ invoke__">split</span>(‘/’).last; <span class="hljs-keyword">if</span> ( _maxFileSizeAllowed < imageSelected.<span class="hljs-title function_ invoke__">lengthSync</span>() / <span class="hljs-number">1024</span>) { String message = ‘File size exceed, maximum file size <span class="hljs-title function_ invoke__">allowed</span>(<span class="hljs-variable">$_maxFileSizeAllowed</span> kB)’; <span class="hljs-title function_ invoke__">_imagePickerResult</span>(<span class="hljs-title function_ invoke__">FilePickerWrapperFailedResult</span>(<span class="hljs-attr">errorMessage</span>: message,<span class="hljs-attr">code</span>: <span class="hljs-number">0</span>)); } <span class="hljs-title function_ invoke__">_imagePickerResult</span>(<span class="hljs-title function_ invoke__">FilePickerWrapperSuccessResult</span>(<span class="hljs-attr">code</span>: <span class="hljs-number">1</span>,<span class="hljs-attr">filePath</span>: imageSelected.path, <span class="hljs-attr">fileName</span>: fileName)); } <span class="hljs-keyword">else</span> { <span class="hljs-title function_ invoke__">_imagePickerResult</span>(<span class="hljs-title function_ invoke__">FilePickerWrapperFailedResult</span>(<span class="hljs-attr">errorMessage</span>: ‘Failed to get the image’,<span class="hljs-attr">code</span>: <span class="hljs-number">0</span>)); } }

Future<<span class="hljs-keyword">void</span>> <span class="hljs-title function_ invoke__">_openFileExplorer</span>() async { <span class="hljs-keyword">final</span> FilePickerWrapperResult wrapperResult = await <span class="hljs-title function_ invoke__">FilePickerWrapper</span>() .<span class="hljs-title function_ invoke__">openFileExplorer</span>( <span class="hljs-attr">maxFileSizeAllowed</span>: <span class="hljs-number">2048</span>, <span class="hljs-attr">fileFormatsAllowed</span>: [‘jpeg’, ‘png’, ‘jpg’]); <span class="hljs-title function_ invoke__">_imagePickerResult</span>(wrapperResult); } }</pre></div><p id="f671">This helper class will provide the functionality to pick an image from the device’s gallery app or take a new one using the device’s camera. The alerts style will be as per the platform (i.e., on iOS, it will be shown in Cupertino style, and, on the Android platform, it will be displayed using Material style).</p><p id="4867">In this blog, we have examined the steps needed to create a UI in Flutter to allow users to pick images from their phones for use with Amazon Rekognition.</p><p id="2179">Next, we design a UI to allow the user to pick images and implement the functionality to pick image/s either from the camera or mobile storage. In the next part of this blog, we will focus on:</p><ul><li>Initiating the action of comparison.</li><li>Convert the raw result into a model.</li><li>Display the result of the comparison.</li></ul><p id="9c29">Read the next part of the blog on implementing facial recognition where we cover these topics:</p><div id="eb9f" class="link-block"> <a href="https://readmedium.com/implementing-facial-recognition-in-flutter-apps-1e99a23ac9c4"> <div> <div> <h2>Implementing Facial Recognition in Flutter Apps</h2> <div><h3>Read our blog to learn how to implement Facial Recognition in Flutter Apps using Amazon Rekognition.</h3></div> <div><p>DLT Labs on medium.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*aGrAV7khLCz6_oKQmAG29w.png)"></div> </div> </div> </a> </div><p id="ca73"><i>Amazon Rekognition is the intellectual property of Amazon Inc. Flutter is a trademark of Google LLC.</i></p><p id="e5a4"><i>Author — Suhail Shabir, DLT Labs</i></p><p id="0f4a"><b>About the Author: </b><i>Suhail </i>is an application development professional who has worked on different platforms and technologies. He has completed his Bachelors in Computer Application from Kashmir University.</p><p id="e3ea">Disclaimer: This article was originally published on the DLT Labs Blog page: <a href="https://www.dltlabs.com/blog/enabling-facial-recognition-in-flutterapps-764220">https://www.dltlabs.com/blog/enabling-facial-recognition-in-flutterapps-764220</a></p><figure id="2629"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/0*0Rjo1bW8T-fHbjiq.png"><figcaption></figcaption></figure></article></body>

Auto AI: Turning AI into Your Own Personal Prompt Engineer

Exploring the next evolution of AI

Image by the Author using DALL-E and Canva

Artificial Intelligence (AI) has completely changed the way that I run my portfolio of websites (which is how I make my living).

The development of AI has brought about significant progress, allowing tasks that traditionally took several hours to complete to now be accomplished in just a matter of seconds.

It’s honestly mind-boggling.

However, even with all these advancements, one of the biggest challenges with AI has been getting it to work efficiently without the need for constant prompting.

This is where Auto AI comes in.

What Is Auto AI?

Auto AI is a system that you can give a goal and the AI goes to work to accomplish that goal, coming up with its own tasks, prompts, etc., until they reach the goal.

With Auto AI, you can ask the AI to research, write, and format an article for one of your self-hosted websites, create a newsletter for you, or come up with a complete Twitter thread. Auto AI takes your goal and does the prompting yourself, making it one step closer to AI doing all the work for you. In simple terms, Auto AI turns AI into your own personal prompt engineer for your specific goals and tasks.

By automating repetitive and time-consuming tasks, businesses and individuals can become more productive, efficient, and competitive.

One recent example is Auto-ChatGPT.

Examples of Auto AI in Action

Auto AI can be applied in a wide range of industries and use cases, from content creation and project management to customer service and healthcare.

Here are some examples of how Auto AI is being used in different industries:

Content Creation

As mentioned earlier, Auto AI can be used to generate content for various purposes. For example, a marketing agency can use Auto AI to create social media posts, blog articles, and other marketing materials for their clients.

An online store can use Auto AI to write product descriptions, reviews, and even recommend products to customers based on their browsing and purchase history.

Project Management

Auto AI can also be used to streamline project management processes.

For example, a construction company can use Auto AI to create project timelines, identify bottlenecks, and optimize resource allocation. Similarly, a software development team can use Auto AI to identify bugs, prioritize tasks, and even suggest solutions to coding problems.

Customer Service

Auto AI can also be used to enhance customer service experiences.

For instance, a retail company can use Auto AI to automate responses to common customer inquiries, such as shipping and return policies. A bank can use Auto AI to analyze customer feedback and suggest improvements to its services.

Auto AI can also be used to analyze customer behavior and suggest personalized recommendations for products and services.

Healthcare

Auto AI can also be used in the healthcare industry to improve patient outcomes.

For example, a hospital can use Auto AI to analyze patient data, identify risk factors, and suggest personalized treatment plans. Auto AI can also be used to monitor patients remotely and alert healthcare providers to potential health issues before they escalate.

The Benefits of Auto AI

There are many advantages of using auto AI.

Increased Efficiency

One of the key benefits of Auto AI is increased efficiency.

With the ability to automate repetitive and time-consuming tasks, employees can focus on more important tasks that require human creativity and intuition.

This can lead to significant time savings, ultimately resulting in increased productivity and output. By leveraging Auto AI, businesses can accomplish more in less time, and with fewer resources, resulting in greater efficiency and profitability.

Improved Accuracy

Auto AI can perform tasks with a high degree of accuracy and consistency, reducing the likelihood of errors and mistakes.

This is especially important in industries such as finance, healthcare, and manufacturing, where accuracy is crucial. With Auto AI, businesses can ensure that their operations are running smoothly and that they are providing the highest level of service to their customers.

Cost Savings

By automating tasks, businesses can reduce labor costs and increase productivity, ultimately resulting in cost savings.

For example, a business that uses Auto AI to automate customer service inquiries can reduce the number of customer service representatives they need to employ, resulting in significant cost savings.

Additionally, businesses that use Auto AI to automate manufacturing processes can reduce the cost of labor and increase production rates, resulting in a higher profit margin.

Improved Decision-Making

Auto AI is capable of processing massive amounts of data and detecting patterns and trends that may not be easily noticeable to humans.

It's advanced algorithms and machine learning capabilities enable it to analyze data with greater speed and accuracy, allowing for deeper insights and more informed decision-making.

This can lead to better decision-making and more informed business strategies.

For example, a business can use Auto AI to analyze customer data and identify patterns in customer behavior, allowing them to create more targeted marketing campaigns and improve their overall customer experience.

By using Auto AI to make data-driven decisions, businesses can ensure that they are making the most informed decisions possible.

The Downsides of Auto AI

But that’s not to say auto AI doesn’t come with any disadvantages.

Here are some of the most pressing.

Limited Creativity

One of the downsides of Auto AI is that it is limited by the data and prompts it receives.

While it can generate content and ideas, it may not have the creativity or intuition of a human. For example, an Auto AI-generated article may lack the unique voice and perspective of a human writer, which can make it less engaging for readers.

However, this limitation can be mitigated by using Auto AI as a tool to augment human capabilities, rather than replace them entirely.

Lack of Human Connection

Auto AI is a machine, and it lacks the human touch that is essential in some industries, such as customer service and healthcare.

For example, while Auto AI can automate customer service inquiries, it may lack the empathy and understanding that a human customer service representative can provide.

To mitigate this issue, one solution is to assign Auto AI to handle routine tasks and inquiries that require less human connection and understanding. For more complex inquiries, it is best to allow human representatives to handle them as they require a higher level of empathy and interpersonal skills that Auto AI may not possess.

This way, businesses can strike a balance between utilizing the efficiency of Auto AI and maintaining the human connection necessary for quality customer service.

Reliance on Data Quality

Auto AI relies on quality data to perform its tasks effectively.

If the data is incomplete, inaccurate, or biased, the results generated by Auto AI may not be reliable. For example, if an Auto AI model is trained on biased data, it may generate biased results.

It is essential to use quality data when working with Auto AI.

Data should be checked for completeness, accuracy, and bias before being used.

Data Security Concerns

Auto AI requires access to sensitive data to perform some tasks.

This raises concerns about data security and privacy, especially if the data is being shared across multiple platforms and systems. For example, if an Auto AI model is used to analyze patient data, it is essential to ensure that the data is encrypted and secured to protect patient privacy.

To mitigate this downside, robust data security measures should be implemented, including encryption, access controls, and regular data backups.

Technical Complexity

Auto AI requires technical expertise to implement and maintain.

This can be a barrier for small businesses and individuals who may not have the resources or skills to use Auto AI effectively. For example, implementing and maintaining an Auto AI system may require knowledge of programming languages, machine learning algorithms, and cloud computing platforms.

According to IT World Canada, this is true of Auto ChatGPT:

Unlike ChatGPT, which lives on a browser, Auto-GPT requires specific software to be downloaded and familiarity with Python to access it. To access Auto-GPT, users need Python 3.8, an OpenAI API key, a PINECONE API key, and an ElevenLabs Key (if they want it to speak). Once users acquire all these, they can follow the detailed instructions on the post to install Auto-GPT.

To mitigate this downside, it is important to assess the technical expertise required to implement and maintain the technology.

If necessary, businesses can consider outsourcing to a third-party provider or partnering with a company that has the required expertise.

On this note, here is a good video about how to set up Auto ChatGPT:

Mitigating the Downsides of Auto AI

To mitigate the downsides of Auto AI, it is important to consider the following:

Use Auto AI as a Tool

Auto AI should be viewed as a tool to augment human capabilities, not replace them entirely. It is important to strike a balance between human creativity and intuition and Auto AI’s ability to automate tasks.

Choose Quality Data

To ensure reliable results, it is essential to use quality data when working with Auto AI. Data should be checked for completeness, accuracy, and bias before being used.

Implement Robust Data Security Measures

To protect sensitive data, robust data security measures should be implemented. This includes encryption, access controls, and regular data backups.

Consider Technical Expertise

When considering Auto AI, it is important to assess the technical expertise required to implement and maintain the technology. If necessary, consider outsourcing to a third-party provider or partnering with a company that has the required expertise.

Auto AI Programs to Check Out

If you’re interested in using Auto AI for your business or personal needs, here are a few related programs you can check out:

  • Auto-GPT One of the most powerful AI language models out there, OPenAI’s GPT can help you generate human-like text, translate languages, and even perform complex calculations.
  • Google’s AutoML — With AutoML, you can build custom machine-learning models without having to write any code. It’s a great tool for businesses looking to leverage AI without having to hire a dedicated data science team.
  • Hugging Face’s Transformers — Transformers, a powerful library for natural language processing (NLP), enables users to create custom language models and conduct Natural Language Processing (NLP) tasks such as assessing the sentiment of a piece of text and classifying it into different categories based on its content.

The Future of Auto AI

As Auto AI continues to evolve and improve, we can expect to see more businesses and individuals adopting this technology.

We may see Auto AI being used to automate even more complex tasks, such as legal research and financial analysis. Additionally, as Auto AI becomes more accessible, we may see smaller businesses and individuals using this technology to level the playing field and compete with larger players in their industries.

And I’m all for that.

Final Thoughts

Auto AI can potentially (and — in my opinion — almost certainly) revolutionize the way we work and live. It needs improving but don’t we all?

If you haven’t already, it’s time to start exploring the world of Auto AI and see how it can help you achieve your goals.

Read more:

More from The Generator

AI
ChatGPT
Artificial Intelligence
Tech
Technology
Recommended from ReadMedium