Gemini Flutter: Text Generation Magic for Flutter Devs! ??
Hey Flutter enthusiasts! ?? Exciting news for all creative minds out there! We've just rolled out version 0.1.0 of Gemini Flutter, your go-to Dart package for seamlessly integrating Gemini APIs into your Flutter applications. ??
Features That'll Blow Your Mind!
1. ?? Gemini-Pro-Vision API Method Added: Say hello to the Gemini-pro-vision API method! ?? This groundbreaking addition unleashes the power of Gemini Pro Vision, taking your vision-related functionalities to new heights. Managing image uploads has never been easier - whether it's an image path, a File object, or base64 encoding, we handle it all for you!
2. ?? Token Count Functionality: Ever wondered how many tokens your methods are consuming? Well, wonder no more! With our new token count functionality, you can easily keep track of token usage. Just set the countToken parameter in your methods, and voilà!
Getting Started is a Breeze! ???
1. Add the gemini_flutter dependency to your pubspec.yaml file.
dependencies:
gemini_flutter: ^0.1.0
2. Run flutter pub get to fetch the dependency.
3. Import the package in your Dart code.
import 'package:gemini_flutter/gemini_flutter.dart';
4. Initialize the GeminiHandler in your main function, replacing "YOUR_API_KEY" with your actual Gemini API key.
void main() {
GeminiHandler().initialize(
apiKey: "YOUR_API_KEY",
temperature: 0.7,
topK: 50,
topP: 0.8,
outputLength: 100,
);
runApp(MyApp());
}
Customize Your Text Generation Experience! ??
Adjust parameters like temperature, topP, topK, and outputLength to tailor the randomness and length of your generated text. Get creative with diverse and focused outputs!
Usage Made Simple! ??
void generateText() async {
final response = await GeminiHandler().geminiPro(
text: "Write a long story about a magic backpack.",
temperature: 0.9,
topP: 0.95,
topK: 40,
outputLength: 1024,
countTokens: true,
);
if (response != null) {
print("Generated Text: ${response.generatedText}");
print("Tokens Consumed: ${response.tokensConsumed}");
}
}
Explore the Magic of Gemini-pro-vision! ????
void generateTextFromImage() async {
final response = await GeminiHandler().geminiProVision(
text: "Write a long story about the image.",
path: "path/to/your/image.jpg",
temperature: 0.9,
topP: 0.95,
topK: 40,
outputLength: 1024,
countTokens: true,
);
if (response != null) {
print("Generated Text: ${response.generatedText}");
print("Tokens Consumed: ${response.tokensConsumed}");
}
}
There you have it! Gemini Flutter is your ticket to effortlessly enhancing text generation in your Flutter apps. ?? Embrace creativity, simplify development, and let Gemini Flutter take you on a journey of endless possibilities! ???
Flutter Developer | Transforming Ideas into Seamless Cross-Platform Apps ??
1 年In this package gemini understand and read the previous communication