naman1102 commited on
Commit
881a09d
·
1 Parent(s): 251a9b3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -8
app.py CHANGED
@@ -601,18 +601,19 @@ def create_ui() -> gr.Blocks:
601
  col_idx = evt.index[1]
602
  print(f"DEBUG: Selected row {row_idx}, column {col_idx}")
603
 
604
- # We want to navigate regardless of which column was clicked
605
- # Get the repository ID from the first column (index 0) of the selected row
606
- if isinstance(df_data, list) and len(df_data) > row_idx:
607
- repo_id = df_data[row_idx][0] if len(df_data[row_idx]) > 0 else ""
608
  print(f"DEBUG: Extracted repo_id = '{repo_id}'")
609
 
610
  # Only proceed if we actually have a repository ID
611
- if repo_id and repo_id.strip():
612
- logger.info(f"Navigating to repo explorer for repository: {repo_id}")
613
- return repo_id.strip(), gr.update(selected="repo_explorer_tab")
 
614
  else:
615
- print(f"DEBUG: df_data is not a list or row_idx {row_idx} out of range")
616
 
617
  except Exception as e:
618
  print(f"DEBUG: Exception occurred: {e}")
 
601
  col_idx = evt.index[1]
602
  print(f"DEBUG: Selected row {row_idx}, column {col_idx}")
603
 
604
+ # Handle pandas DataFrame
605
+ if isinstance(df_data, pd.DataFrame) and not df_data.empty and row_idx < len(df_data):
606
+ # Get the repository ID from the first column (repo id)
607
+ repo_id = df_data.iloc[row_idx, 0] # First column contains repo id
608
  print(f"DEBUG: Extracted repo_id = '{repo_id}'")
609
 
610
  # Only proceed if we actually have a repository ID
611
+ if repo_id and str(repo_id).strip() and str(repo_id).strip() != 'nan':
612
+ clean_repo_id = str(repo_id).strip()
613
+ logger.info(f"Navigating to repo explorer for repository: {clean_repo_id}")
614
+ return clean_repo_id, gr.update(selected="repo_explorer_tab")
615
  else:
616
+ print(f"DEBUG: df_data is not a DataFrame or row_idx {row_idx} out of range")
617
 
618
  except Exception as e:
619
  print(f"DEBUG: Exception occurred: {e}")