test ai
This commit is contained in:
parent
9781490fa5
commit
103046b5a4
@ -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(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user