Spaces:
Runtime error
Runtime error
Delete app.py
Browse files
app.py
DELETED
|
@@ -1,31 +0,0 @@
|
|
| 1 |
-
import streamlit as st
|
| 2 |
-
import google-generativeai as genAi
|
| 3 |
-
from PIL import Image
|
| 4 |
-
|
| 5 |
-
# Configure API key
|
| 6 |
-
genAi.configure(api_key="AIzaSyBZQmot8_8bDxuGiffJ06woJCzH140Erc4")
|
| 7 |
-
|
| 8 |
-
def get_response(inputt, image):
|
| 9 |
-
model = genAi.GenerativeModel('gemini-pro-vision')
|
| 10 |
-
if inputt != "":
|
| 11 |
-
response = model.generate_content([inputt, image])
|
| 12 |
-
else:
|
| 13 |
-
response = model.generate_content(image)
|
| 14 |
-
return response.text
|
| 15 |
-
|
| 16 |
-
# Streamlit app header and user inputs
|
| 17 |
-
st.header("PROJECT")
|
| 18 |
-
inputt = st.text_input("Input Prompt", key='inputt')
|
| 19 |
-
upload_file = st.file_uploader("Choose your file", type=['jpg', 'jpeg', 'png'])
|
| 20 |
-
image = ''
|
| 21 |
-
|
| 22 |
-
if upload_file is not None:
|
| 23 |
-
image = Image.open(upload_file)
|
| 24 |
-
st.image(image, caption="Uploaded Image", use_column_width=True)
|
| 25 |
-
|
| 26 |
-
# Button to trigger content generation
|
| 27 |
-
submit = st.button("ASK")
|
| 28 |
-
|
| 29 |
-
if submit:
|
| 30 |
-
response = get_response(inputt, image)
|
| 31 |
-
st.write(response)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|