overtai / app.py
rodincode's picture
Update app.py
69b7d56 verified
raw
history blame contribute delete
772 Bytes
import gradio as gr
import cv2
from PIL import Image
import PIL.PngImagePlugin
import google.generativeai as genai
# Initialize the GenerativeModel
genai.configure(api_key='AIzaSyDpsP6LqSShjygGU_P6t0Hex7wn320XGxw')
model = genai.GenerativeModel('gemini-pro-vision')
def process_frames(prompt, img):
frame_pil = Image.fromarray(img)
response = model.generate_content([prompt, frame_pil])
return response.text
iface = gr.Interface(fn=process_frames,
inputs=["text", "image"],
outputs="text",
title="Gemini Pro Vision Demo",
description="Enter a prompt and view the generated content.",
allow_flagging=False)
if __name__ == "__main__":
iface.launch()