File size: 683 Bytes
271a3d2
4b51045
24488cc
4b51045
6f1f950
 
24488cc
4b51045
6f1f950
24488cc
 
cddd4e0
59d059f
cddd4e0
 
24488cc
 
 
5fedf9f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import gradio as gr
import google.generativeai as genai

token = "AIzaSyDYhyRoOWBJWOb4bqY5wmFLrBo4HTwQDko"
genai.configure(api_key=token)

# Chargez l'image
model = genai.GenerativeModel(model_name="gemini-pro-vision")

# Fonction pour générer le contenu
def generate_content(image):
    response = model.generate_content(["Write a short, engaging blog post based on this picture. It should include a description of the meal in the photo and talk about my journey meal prepping.", image])
    print(response.text)
    
    return response.resolve()

# Interface Gradio
iface = gr.Interface(fn=generate_content, inputs=gr.Image(type='pil'), outputs="text")
iface.launch(share=True)