rairo commited on
Commit
46921e6
·
verified ·
1 Parent(s): c0b1345

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -13
app.py CHANGED
@@ -49,19 +49,8 @@ def generateResponse(prompt, dfs):
49
  llm = GoogleGemini(api_key=GOOGLE_API_KEY)
50
  response_parser = StreamLitResponse({})
51
  pandas_agent = SmartDatalake(dfs, config={"llm": llm, "response_parser": response_parser})
52
- try:
53
-
54
- results = pandas_agent.chat(prompt)
55
- if not results: # If results is empty
56
- return {"type": "text", "value": "No results found for your query."} # Return a default message as a dictionary
57
- elif len(results) == 1: # If results contains only one object, return the object directly
58
- return results[0]
59
- else:
60
- return results # Return the list of results
61
- except Exception as e: # Catch any exceptions during PandasAI processing
62
- st.error(f"Error in PandasAI: {e}") # Display the error in Streamlit
63
- return {"type": "text", "value": f"An error occurred: {e}"}
64
-
65
 
66
  # Processing pdfs
67
  def get_pdf_text(pdf_docs):
 
49
  llm = GoogleGemini(api_key=GOOGLE_API_KEY)
50
  response_parser = StreamLitResponse({})
51
  pandas_agent = SmartDatalake(dfs, config={"llm": llm, "response_parser": response_parser})
52
+ answer = pandas_agent.chat(prompt)
53
+ return answer
 
 
 
 
 
 
 
 
 
 
 
54
 
55
  # Processing pdfs
56
  def get_pdf_text(pdf_docs):