Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,32 +1,17 @@
|
|
| 1 |
-
|
| 2 |
-
# coding: utf-8
|
| 3 |
-
|
| 4 |
-
# In[1]:
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
import streamlit as st
|
| 8 |
import google.generativeai as genai
|
| 9 |
genai.configure(api_key='AIzaSyDnBVZRrktkc-gOzW-5gQqNGxDIrBUD5bI')
|
| 10 |
-
|
| 11 |
st.title('Analyze Image with Google Gemini')
|
| 12 |
-
model
|
| 13 |
from PIL import Image
|
| 14 |
-
|
| 15 |
-
# Kullanıcıların jpg, jpeg veya png türünde resimler yüklemesine izin veren bir dosya yükleme widget'ı oluşturur
|
| 16 |
-
resim = st.file_uploader("Bir resim seç", type=(['jpg', 'jpeg', 'png']))
|
| 17 |
-
|
| 18 |
if resim is not None:
|
| 19 |
-
img
|
| 20 |
st.image(img)
|
| 21 |
-
|
|
|
|
|
|
|
| 22 |
if st.button('soru sor'):
|
| 23 |
-
response
|
| 24 |
response.resolve()
|
| 25 |
-
st.write(response.text)
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
# In[ ]:
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
|
|
|
| 1 |
+
import streamlit as st
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
import google.generativeai as genai
|
| 3 |
genai.configure(api_key='AIzaSyDnBVZRrktkc-gOzW-5gQqNGxDIrBUD5bI')
|
|
|
|
| 4 |
st.title('Analyze Image with Google Gemini')
|
| 5 |
+
model=genai.GenerativeModel('gemini-pro-vision')
|
| 6 |
from PIL import Image
|
| 7 |
+
resim=st.file_uploader("Bir resim sec", type=(['jpg','jpeg','png']))
|
|
|
|
|
|
|
|
|
|
| 8 |
if resim is not None:
|
| 9 |
+
img=Image.open(resim)
|
| 10 |
st.image(img)
|
| 11 |
+
#response=model.generate_content(img)
|
| 12 |
+
#st.write(response.text)
|
| 13 |
+
soru=st.text_input('Soru')
|
| 14 |
if st.button('soru sor'):
|
| 15 |
+
response=model.generate_content([soru,img], stream=True)
|
| 16 |
response.resolve()
|
| 17 |
+
st.write(response.text)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|