Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -29,24 +29,12 @@ def main():
|
|
| 29 |
llm = Anthropic(temperature=0.0, model='claude-3-opus-20240229', api_key=api_key)
|
| 30 |
query_engine = PandasQueryEngine(df=df, llm=llm, verbose=True)
|
| 31 |
|
| 32 |
-
#
|
| 33 |
-
if "is_enter_pressed" not in st.session_state:
|
| 34 |
-
st.session_state.is_enter_pressed = False
|
| 35 |
-
|
| 36 |
-
# Continous chat
|
| 37 |
question = st.text_input("Ask a question about the data:")
|
| 38 |
-
|
| 39 |
-
if
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
st.markdown(f"**Response:** {response}")
|
| 43 |
-
|
| 44 |
-
# For continuous chat
|
| 45 |
-
question = st.text_input("Ask another question:")
|
| 46 |
-
st.session_state.is_enter_pressed = st.button("Enter")
|
| 47 |
-
|
| 48 |
-
if st.session_state.is_enter_pressed:
|
| 49 |
-
break
|
| 50 |
|
| 51 |
if __name__ == "__main__":
|
| 52 |
main()
|
|
|
|
| 29 |
llm = Anthropic(temperature=0.0, model='claude-3-opus-20240229', api_key=api_key)
|
| 30 |
query_engine = PandasQueryEngine(df=df, llm=llm, verbose=True)
|
| 31 |
|
| 32 |
+
# Input user question
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
question = st.text_input("Ask a question about the data:")
|
| 34 |
+
if st.button("Submit"):
|
| 35 |
+
if question:
|
| 36 |
+
response = query_engine.query(question)
|
| 37 |
+
st.markdown(f"**Response:** {response}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
if __name__ == "__main__":
|
| 40 |
main()
|