qqwjq1981 commited on
Commit
17c8ed9
·
verified ·
1 Parent(s): 040bc02

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -2
app.py CHANGED
@@ -782,9 +782,19 @@ shared_state = {"project_desc_table": pd.DataFrame(), "task_analysis_txt": "", "
782
  # Button Action: Fetch State
783
  def fetch_updated_state():
784
  response = requests.get("http://localhost:7860/state")
785
- state = response.json()
 
 
 
 
 
 
 
 
 
786
  """Fetch the updated shared state from FastAPI."""
787
- return pd.DataFrame(state["project_desc_table"]), state["task_analysis_txt"], pd.DataFrame(state["execution_status"]), state["execution_results"]
 
788
 
789
  def update_gradio_state(project_desc_table, task_analysis_txt, execution_status, execution_results):
790
  # You can update specific components like Textbox or State
 
782
  # Button Action: Fetch State
783
  def fetch_updated_state():
784
  response = requests.get("http://localhost:7860/state")
785
+ # Check the status code and the raw response
786
+ if response.status_code == 200:
787
+ try:
788
+ state = response.json() # Try to parse JSON
789
+ return pd.DataFrame(state["project_desc_table"]), state["task_analysis_txt"], pd.DataFrame(state["execution_status"]), state["execution_results"]
790
+ except ValueError as e:
791
+ logger.error(f"JSON decoding failed: {e}")
792
+ logger.debug("Raw response body:", response.text)
793
+ else:
794
+ logger.error(f"Error: {response.status_code} - {response.text}")
795
  """Fetch the updated shared state from FastAPI."""
796
+ return pd.DataFrame(), "", pd.DataFrame(), {}
797
+
798
 
799
  def update_gradio_state(project_desc_table, task_analysis_txt, execution_status, execution_results):
800
  # You can update specific components like Textbox or State