Sakil commited on
Commit
0cad2e5
·
verified ·
1 Parent(s): 1808d8f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -8
app.py CHANGED
@@ -29,16 +29,20 @@ 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
- # 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
- # Displaying the response
38
- if response.startswith('http'):
39
- st.image(response, use_column_width=True)
40
- else:
41
  st.markdown(f"**Response:** {response}")
42
 
 
 
 
 
 
 
 
43
  if __name__ == "__main__":
44
  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
+ # Continous chat
33
  question = st.text_input("Ask a question about the data:")
34
+ while True:
35
+ if st.button("Submit") or st.session_state.is_enter_pressed:
36
+ if question:
37
+ response = query_engine.query(question)
 
 
 
38
  st.markdown(f"**Response:** {response}")
39
 
40
+ # For continuous chat
41
+ st.text_input("Ask another question:", key="question")
42
+ st.session_state.is_enter_pressed = False
43
+
44
+ if st.session_state.is_enter_pressed:
45
+ break
46
+
47
  if __name__ == "__main__":
48
  main()