Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -8,10 +8,6 @@ import json
|
|
8 |
# Set the OpenAI API key
|
9 |
openai.api_key = os.getenv("OPENAI_API_KEY")
|
10 |
|
11 |
-
# Set up the Hugging Face Dataset Saver
|
12 |
-
HF_TOKEN = os.getenv("HF_TOKEN")
|
13 |
-
hf_writer = CustomHuggingFaceDatasetSaver(HF_TOKEN, "CannaTech/Flagged")
|
14 |
-
|
15 |
# Define the CustomHuggingFaceDatasetSaver class
|
16 |
class CustomHuggingFaceDatasetSaver(gr.FlaggingCallback):
|
17 |
def setup(self):
|
@@ -34,6 +30,10 @@ class CustomHuggingFaceDatasetSaver(gr.FlaggingCallback):
|
|
34 |
writer = csv.writer(f)
|
35 |
writer.writerow([input_data, output_data, flag])
|
36 |
|
|
|
|
|
|
|
|
|
37 |
# Define the authentication function
|
38 |
def check_auth(username, password):
|
39 |
# Get the credentials from the environment variable
|
|
|
8 |
# Set the OpenAI API key
|
9 |
openai.api_key = os.getenv("OPENAI_API_KEY")
|
10 |
|
|
|
|
|
|
|
|
|
11 |
# Define the CustomHuggingFaceDatasetSaver class
|
12 |
class CustomHuggingFaceDatasetSaver(gr.FlaggingCallback):
|
13 |
def setup(self):
|
|
|
30 |
writer = csv.writer(f)
|
31 |
writer.writerow([input_data, output_data, flag])
|
32 |
|
33 |
+
# Set up the Hugging Face Dataset Saver
|
34 |
+
HF_TOKEN = os.getenv("HF_TOKEN")
|
35 |
+
hf_writer = CustomHuggingFaceDatasetSaver(HF_TOKEN, "CannaTech/Flagged")
|
36 |
+
|
37 |
# Define the authentication function
|
38 |
def check_auth(username, password):
|
39 |
# Get the credentials from the environment variable
|