Nina
commited on
Commit
•
6319dc6
1
Parent(s):
19a9d09
add userid random
Browse files
utils.py
CHANGED
@@ -1,6 +1,8 @@
|
|
1 |
import numpy as np
|
2 |
import openai
|
3 |
import os
|
|
|
|
|
4 |
|
5 |
|
6 |
def is_climate_change_related(sentence: str, classifier) -> bool:
|
@@ -44,3 +46,10 @@ def set_openai_api_key(text):
|
|
44 |
if text.startswith("sk-") and len(text) > 10:
|
45 |
openai.api_key = text
|
46 |
return f"You're all set: this is your api key: {openai.api_key}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import numpy as np
|
2 |
import openai
|
3 |
import os
|
4 |
+
import random
|
5 |
+
import string
|
6 |
|
7 |
|
8 |
def is_climate_change_related(sentence: str, classifier) -> bool:
|
|
|
46 |
if text.startswith("sk-") and len(text) > 10:
|
47 |
openai.api_key = text
|
48 |
return f"You're all set: this is your api key: {openai.api_key}"
|
49 |
+
|
50 |
+
|
51 |
+
def get_random_string(length):
|
52 |
+
# choose from all lowercase letter
|
53 |
+
letters = string.ascii_lowercase
|
54 |
+
result_str = "".join(random.choice(letters) for i in range(length))
|
55 |
+
print("Random string of length", length, "is:", result_str)
|