Omartificial-Intelligence-Space commited on
Commit
9832c5a
·
verified ·
1 Parent(s): f5d713a

update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -64,7 +64,10 @@ def evaluate_model(model_id):
64
  # Rename columns
65
  dataset = dataset.rename_column(dataset_info["columns"][0], "anchor")
66
  dataset = dataset.rename_column(dataset_info["columns"][1], "positive")
67
- dataset = dataset.add_column("id", range(len(dataset)))
 
 
 
68
 
69
  # Prepare queries and corpus
70
  corpus = dict(zip(dataset["id"], dataset["positive"]))
@@ -123,4 +126,4 @@ demo = gr.Interface(
123
 
124
  # Launch the Gradio app
125
  if __name__ == "__main__":
126
- demo.launch(debug = True)
 
64
  # Rename columns
65
  dataset = dataset.rename_column(dataset_info["columns"][0], "anchor")
66
  dataset = dataset.rename_column(dataset_info["columns"][1], "positive")
67
+
68
+ # Check if "id" column already exists before adding it
69
+ if "id" not in dataset.column_names:
70
+ dataset = dataset.add_column("id", range(len(dataset)))
71
 
72
  # Prepare queries and corpus
73
  corpus = dict(zip(dataset["id"], dataset["positive"]))
 
126
 
127
  # Launch the Gradio app
128
  if __name__ == "__main__":
129
+ demo.launch()