naman1102 commited on
Commit
aeebb75
·
1 Parent(s): 3414412

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -69,6 +69,9 @@ def show_combined_repo_and_llm():
69
  try:
70
  df = pd.read_csv(csv_filename)
71
  highlight_idx = None
 
 
 
72
  for idx, row in df.iterrows():
73
  if row["repo id"] == repo_id:
74
  highlight_idx = idx
@@ -84,7 +87,7 @@ def show_combined_repo_and_llm():
84
  highlight_idx = None
85
  # Move to next repo for next click
86
  current_repo_idx += 1
87
- return combined_content, llm_output, df, highlight_idx
88
 
89
  repo_id_input = gr.Textbox(label="Enter repo IDs (comma or newline separated)", lines=5, placeholder="repo1, repo2\nrepo3")
90
  df_output = gr.Dataframe(headers=["repo id", "strength", "weaknesses", "speciality", "relevance rating", "Usecase"])
@@ -101,8 +104,10 @@ with gr.Blocks() as demo:
101
  combine_btn = gr.Button("Download, Combine & Show .py/.md Files from Next Repo and Analyze")
102
  combined_txt = gr.Textbox(label="Combined Repo Files", lines=20)
103
  llm_output_txt = gr.Textbox(label="LLM Analysis Output", lines=10)
104
- df_display = gr.Dataframe(headers=["repo id", "strength", "weaknesses", "speciality", "relevance rating", "Usecase"])
105
- highlight_row = gr.HighlightedText(label="Highlighted Row Index")
106
- combine_btn.click(show_combined_repo_and_llm, inputs=None, outputs=[combined_txt, llm_output_txt, df_display, highlight_row])
 
 
107
 
108
  demo.launch()
 
69
  try:
70
  df = pd.read_csv(csv_filename)
71
  highlight_idx = None
72
+ # Cast columns to string to avoid dtype issues
73
+ for col in ["strength", "weaknesses", "speciality", "relevance rating"]:
74
+ df[col] = df[col].astype(str)
75
  for idx, row in df.iterrows():
76
  if row["repo id"] == repo_id:
77
  highlight_idx = idx
 
87
  highlight_idx = None
88
  # Move to next repo for next click
89
  current_repo_idx += 1
90
+ return combined_content, llm_output, (df, [highlight_idx] if highlight_idx is not None else [])
91
 
92
  repo_id_input = gr.Textbox(label="Enter repo IDs (comma or newline separated)", lines=5, placeholder="repo1, repo2\nrepo3")
93
  df_output = gr.Dataframe(headers=["repo id", "strength", "weaknesses", "speciality", "relevance rating", "Usecase"])
 
104
  combine_btn = gr.Button("Download, Combine & Show .py/.md Files from Next Repo and Analyze")
105
  combined_txt = gr.Textbox(label="Combined Repo Files", lines=20)
106
  llm_output_txt = gr.Textbox(label="LLM Analysis Output", lines=10)
107
+ df_display = gr.Dataframe(
108
+ headers=["repo id", "strength", "weaknesses", "speciality", "relevance rating", "Usecase"],
109
+ highlight_row=True
110
+ )
111
+ combine_btn.click(show_combined_repo_and_llm, inputs=None, outputs=[combined_txt, llm_output_txt, df_display])
112
 
113
  demo.launch()