Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -37,7 +37,6 @@ class ChatBot:
|
|
37 |
json=data,
|
38 |
)
|
39 |
response_json = response.json()
|
40 |
-
response_text = response_json.get("contents", [{}])[0].get("parts", [{}])[0].get("text", "")
|
41 |
return response_text
|
42 |
|
43 |
def get_history(self) -> list:
|
@@ -69,7 +68,8 @@ if uploaded_file is not None:
|
|
69 |
user_input = st.text_input("Ask a question about the image:")
|
70 |
|
71 |
if user_input:
|
72 |
-
|
|
|
73 |
st.session_state.conversation.append({"user": user_input, "bot": response})
|
74 |
|
75 |
if st.session_state.conversation:
|
|
|
37 |
json=data,
|
38 |
)
|
39 |
response_json = response.json()
|
|
|
40 |
return response_text
|
41 |
|
42 |
def get_history(self) -> list:
|
|
|
68 |
user_input = st.text_input("Ask a question about the image:")
|
69 |
|
70 |
if user_input:
|
71 |
+
json_response = chatbot.generate_response(user_input)
|
72 |
+
response = json_response["candidates"][0]["content"]["parts"][0]["text"]
|
73 |
st.session_state.conversation.append({"user": user_input, "bot": response})
|
74 |
|
75 |
if st.session_state.conversation:
|