File size: 729 Bytes
5cdce89
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import streamlit as st
import google.generativeai as genai
genai.configure(api_key="AIzaSyDM1ZP6Tvmg_RSOwk0RIvz-noUDlUxR8Fc")
from PIL import Image
def get_response(inp,img):
    model=genai.GenerativeModel('gemini-pro-vision')
    if(inp!=""):
        response=model.generate_content([inp,img])
    else:
        response=model.generate_content(image)
    return response.text
st.header("Project")
inpu=st.text_input("Enter your input:",key='input')

upf=st.file_uploader("Drag your image ",type=['jpeg','jpg','png'])
if(upf is not None):
    image=Image.open(upf)
    st.image(image,caption='uploaded image',use_column_width=True)
submit=st.button("Ask")
if(submit):
    resp=get_response(img=image,inp=inpu)
    st.write(resp)