first test ok
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'dart:io';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
|
||||
import 'package:flutter_gemini/flutter_gemini.dart';
|
||||
|
||||
void main() {
|
||||
Gemini.init(apiKey: 'AIzaSyAt1LQIV_hwJQF56sXjb4oxEZEC0wI3PKg');
|
||||
|
||||
runApp(MyApp());
|
||||
}
|
||||
|
||||
@@ -54,8 +53,10 @@ class DisplayPictureScreenState extends State<DisplayPictureScreen> {
|
||||
}
|
||||
|
||||
Future<void> _getEventInfosFromImage() async {
|
||||
Gemini.init(apiKey: 'AIzaSyAt1LQIV_hwJQF56sXjb4oxEZEC0wI3PKg');
|
||||
final gemini = Gemini.instance;
|
||||
await dotenv.load();
|
||||
|
||||
final gemini = Gemini.init(
|
||||
apiKey: dotenv.env['GEMINI_API_KEY']!, enableDebugging: true);
|
||||
|
||||
final file = File(widget.imagePath);
|
||||
|
||||
@@ -63,7 +64,7 @@ class DisplayPictureScreenState extends State<DisplayPictureScreen> {
|
||||
.textAndImage(
|
||||
text: "What is this picture ?", images: [file.readAsBytesSync()])
|
||||
.then((value) => print(value?.content?.parts?.last.text ?? ''))
|
||||
.catchError((e) => print(e));
|
||||
.catchError((e) => print("problem gemini : ${e}"));
|
||||
}
|
||||
|
||||
@override
|
||||
|
Reference in New Issue
Block a user