File size: 841 Bytes
71f5388
105c824
71f5388
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import streamlit as st 
import google-generativeai as genAi
from PIL import Image
             
genAi.configure(api_key="AIzaSyBZQmot8_8bDxuGiffJ06woJCzH140Erc4str") 

def get_response(inputt,image):
    model=genAi.GenerativeModel('gemini-pro-vision')
    if inputt!="":
        response=model.generate_content([inputt,image])
    else:
        # response=model.generate_content([image])
        response=model.generate_content(image)
    return response.text

st.header("PROJECT")
input=st.text_input("Input Prompt",key='input')
upload_file=st.file_uploader("Choose yout file",type=['jpg','jpeg','png'])
image=''
if upload_file is not None:
    image=Image.open(upload_file)
    st.image(image,caption="uploaded_image",use_column_width=True)

submit=st.button("ASK")
if submit:
    response=get_response(input,image)
    st.write(response)