diff --git a/.buildinfo b/.buildinfo index 8e507361..7c150d29 100644 --- a/.buildinfo +++ b/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: d9d9e69a9d88ed67452e1276d502952f +config: d178f46213b5fc120390f16cb1bcb36a tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/_modules/index.html b/_modules/index.html new file mode 100644 index 00000000..e0a62f76 --- /dev/null +++ b/_modules/index.html @@ -0,0 +1,243 @@ + + + + + + + Overview: module code — SQuADDS 0.1.0 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
+
+ + +
+
+
+ + +
+ +
+
+
+ +
+ + + + +
+
+ + +
+
+
+ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/_modules/squadds/core/utils.html b/_modules/squadds/core/utils.html new file mode 100644 index 00000000..a08584d9 --- /dev/null +++ b/_modules/squadds/core/utils.html @@ -0,0 +1,332 @@ + + + + + + + squadds.core.utils — SQuADDS 0.1.0 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
+
+ + +
+
+
+ + +
+ +
+
+
+
+ +

Source code for squadds.core.utils

+import urllib.parse
+import webbrowser
+import getpass
+import os
+from huggingface_hub import HfApi, HfFolder
+from squadds.core.globals import ENV_FILE_PATH
+
+
+[docs] +def set_huggingface_api_key(): + """ + Sets the Hugging Face API key by appending it to the .env file. + If the API key already exists in the .env file, it does not add it again. + If the Hugging Face token is not found, it raises a ValueError. + """ + # Check if API key already exists + if os.path.exists(ENV_FILE_PATH): + with open(ENV_FILE_PATH, 'r') as file: + existing_keys = file.read() + if 'HUGGINGFACE_API_KEY=' in existing_keys: + print('API key already exists in .env file.') + return + + # Ask for the new API key + api_key = getpass.getpass("Enter your Hugging Face API key: ") + # Append the new API key to the .env file + with open(ENV_FILE_PATH, 'a') as file: + file.write(f'\nHUGGINGFACE_API_KEY={api_key}\n') + print('API key added to .env file.') + + api = HfApi() + token = HfFolder.get_token() + if token is None: + raise ValueError("Hugging Face token not found. Please log in using `huggingface-cli login`.")
+ + + + + + + +
+[docs] +def send_email_via_client(dataset_name, institute, pi_name, date, dataset_link): + """ + Sends an email notification to recipients with the details of the created dataset. + + Args: + dataset_name (str): The name of the dataset. + institute (str): The name of the institute where the dataset was created. + pi_name (str): The name of the principal investigator who created the dataset. + date (str): The date when the dataset was created. + dataset_link (str): The link to the created dataset. + + Returns: + None + """ + recipients = ["shanto@usc.edu", "elevenso@usc.edu"] + subject = f"SQuADDS: Dataset Created - {dataset_name} ({date})" + body = f"{dataset_name} has been created by {pi_name} at {institute} on {date}.\nHere is the link - {dataset_link}" + + mailto_link = create_mailto_link(recipients, subject, body) + webbrowser.open(mailto_link)
+ +
+ +
+
+ + + + +
+
+ + +
+
+
+ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/_sources/tutorials/index.rst.txt b/_sources/tutorials/index.rst.txt index d13cebe4..578bbb21 100644 --- a/_sources/tutorials/index.rst.txt +++ b/_sources/tutorials/index.rst.txt @@ -6,4 +6,5 @@ Tutorials Tutorial-1_Getting_Started_with_SQuADDS.ipynb Tutorial-2_Contributing_to_SQuADDS.ipynb - More Tutorials Coming Soon! \ No newline at end of file + +| More Tutorials Coming Soon! \ No newline at end of file diff --git a/genindex.html b/genindex.html index ea7cecf5..18312f81 100644 --- a/genindex.html +++ b/genindex.html @@ -144,8 +144,60 @@

Index

+ C + | M + | S
+

C

+ + +
+ +

M

+ + +
+ +

S

+ + + +
    +
  • + squadds.core.utils + +
  • +
+ diff --git a/modules.html b/modules.html index 8a4de249..ee72ff1f 100644 --- a/modules.html +++ b/modules.html @@ -151,8 +151,8 @@

SQuADDS
  • Subpackages +
    +
    More Tutorials Coming Soon!
    +