Download app.py from rodincode/overtai: direct link, hf CLI and curl.
- Browser
- Download file 772 Bytes
-
https://huggingface.co/spaces/rodincode/overtai/resolve/main/app.py
- Command line
-
hf download hf://spaces/rodincode/overtai/app.py
-
curl -L -o app.py https://huggingface.co/spaces/rodincode/overtai/resolve/main/app.py
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() | |