Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -49,16 +49,16 @@ if uploaded_file is not None:
|
|
49 |
st.session_state.conversation = []
|
50 |
|
51 |
user_input = st.text_input("Ask a question about the image:")
|
52 |
-
|
53 |
-
if user_input:
|
54 |
-
json_response = call_gemini_api(image_base64, api_key, user_input)
|
55 |
-
response = json_response["candidates"][0]["content"]["parts"][0]["text"]
|
56 |
-
st.session_state.conversation.append({"user": user_input, "bot": response})
|
57 |
-
|
58 |
if st.session_state.conversation:
|
59 |
for chat in st.session_state.conversation:
|
60 |
st.write(f"**You:** {chat['user']}")
|
61 |
st.write(f"**Bot:** {chat['bot']}")
|
62 |
|
|
|
|
|
|
|
|
|
|
|
63 |
else:
|
64 |
st.sidebar.text("Please upload an image to start the conversation.")
|
|
|
49 |
st.session_state.conversation = []
|
50 |
|
51 |
user_input = st.text_input("Ask a question about the image:")
|
52 |
+
|
|
|
|
|
|
|
|
|
|
|
53 |
if st.session_state.conversation:
|
54 |
for chat in st.session_state.conversation:
|
55 |
st.write(f"**You:** {chat['user']}")
|
56 |
st.write(f"**Bot:** {chat['bot']}")
|
57 |
|
58 |
+
if user_input:
|
59 |
+
json_response = call_gemini_api(image_base64, api_key, user_input)
|
60 |
+
response = json_response["candidates"][0]["content"]["parts"][0]["text"]
|
61 |
+
st.session_state.conversation.append({"user": user_input, "bot": response})
|
62 |
+
|
63 |
else:
|
64 |
st.sidebar.text("Please upload an image to start the conversation.")
|