Skip to content

Commit

Permalink
s
Browse files Browse the repository at this point in the history
  • Loading branch information
AP-047 committed May 3, 2024
1 parent c7ee969 commit b883231
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions authorship-verification-submission/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,22 @@
"nlpbuw-fsu-sose-24", "authorship-verification-validation-20240408-training"
)

# Define the path for the model
model_path = Path(__file__).parent / "model.joblib"

# Check if the model exists, if not, handle the case appropriately
if not model_path.exists():
print("Model file not found. Please ensure the model has been trained and the path is correct.")
exit(1) # Exit if the model is not found

# Load the model and make predictions
model = load(Path(__file__).parent / "model.joblib")
predictions = model.predict(df["text"])
df["generated"] = predictions
df = df[["id", "generated"]]
model = load(model_path)
predictions = model.predict(df["text"])
df["generated"] = predictions
df = df[["id", "generated"]]

# Save the predictions
output_directory = get_output_directory(str(Path(__file__).parent))
output_file = Path(output_directory) / "predictions.jsonl"
df.to_json(output_file, orient="records", lines=True)
print(f"Predictions saved to {output_file}.")
# Save the predictions
output_directory = get_output_directory(str(Path(__file__).parent))
output_file = Path(output_directory) / "predictions.jsonl"
df.to_json(output_file, orient="records", lines=True)
print(f"Predictions saved to {output_file}.")

0 comments on commit b883231

Please sign in to comment.