LOVEBHATTI commited on
Commit
71f5388
1 Parent(s): af003e7

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -0
app.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import google.generativeai as genAi
3
+ from PIL import Image
4
+
5
+ genAi.configure(api_key="AIzaSyBZQmot8_8bDxuGiffJ06woJCzH140Erc4str")
6
+
7
+ def get_response(inputt,image):
8
+ model=genAi.GenerativeModel('gemini-pro-vision')
9
+ if inputt!="":
10
+ response=model.generate_content([inputt,image])
11
+ else:
12
+ # response=model.generate_content([image])
13
+ response=model.generate_content(image)
14
+ return response.text
15
+
16
+ st.header("PROJECT")
17
+ input=st.text_input("Input Prompt",key='input')
18
+ upload_file=st.file_uploader("Choose yout file",type=['jpg','jpeg','png'])
19
+ image=''
20
+ if upload_file is not None:
21
+ image=Image.open(upload_file)
22
+ st.image(image,caption="uploaded_image",use_column_width=True)
23
+
24
+ submit=st.button("ASK")
25
+ if submit:
26
+ response=get_response(input,image)
27
+ st.write(response)