Spaces:
Sleeping
Sleeping
drmurataltun
commited on
Upload 2 files
Browse files- app.py +32 -0
- requirements.txt +2 -0
app.py
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env python
|
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 = genai.GenerativeModel('gemini-pro-vision')
|
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 = Image.open(resim)
|
20 |
+
st.image(img)
|
21 |
+
soru = st.text_input('Soru')
|
22 |
+
if st.button('soru sor'):
|
23 |
+
response = Image1_generate_content([soru, img], stream=True)
|
24 |
+
response.resolve()
|
25 |
+
st.write(response.text)
|
26 |
+
|
27 |
+
|
28 |
+
# In[ ]:
|
29 |
+
|
30 |
+
|
31 |
+
|
32 |
+
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
streamlit
|
2 |
+
google-generativeai
|