feature/ai-image #4

Merged
v4l3n71n merged 9 commits from feature/ai-image into main 2024-07-17 20:56:08 +00:00
Showing only changes of commit 103046b5a4 - Show all commits

View File

@ -46,6 +46,26 @@ class DisplayPictureScreen extends StatefulWidget {
// A widget that displays the picture taken by the user. // A widget that displays the picture taken by the user.
class DisplayPictureScreenState extends State<DisplayPictureScreen> { class DisplayPictureScreenState extends State<DisplayPictureScreen> {
@override
void initState() {
super.initState();
_getEventInfosFromImage();
}
Future<void> _getEventInfosFromImage() async {
Gemini.init(apiKey: 'AIzaSyAt1LQIV_hwJQF56sXjb4oxEZEC0wI3PKg');
final gemini = Gemini.instance;
final file = File(widget.imagePath);
gemini
.textAndImage(
text: "What is this picture ?", images: [file.readAsBytesSync()])
.then((value) => print(value?.content?.parts?.last.text ?? ''))
.catchError((e) => print(e));
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(