Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
b9877bd
1
Parent(s):
7762285
print_debug
Browse files- prompt_generator.py +4 -0
prompt_generator.py
CHANGED
|
@@ -113,6 +113,7 @@ class PromptGenerator:
|
|
| 113 |
def load_next_data(self):
|
| 114 |
next_data = {}
|
| 115 |
next_path = os.path.join("data", "next")
|
|
|
|
| 116 |
for category in os.listdir(next_path):
|
| 117 |
category_path = os.path.join(next_path, category)
|
| 118 |
if os.path.isdir(category_path):
|
|
@@ -120,12 +121,15 @@ class PromptGenerator:
|
|
| 120 |
for file in os.listdir(category_path):
|
| 121 |
if file.endswith(".json"):
|
| 122 |
file_path = os.path.join(category_path, file)
|
|
|
|
| 123 |
with open(file_path, "r", encoding="utf-8") as f:
|
| 124 |
json_data = json.load(f)
|
| 125 |
next_data[category][file[:-5]] = json_data
|
|
|
|
| 126 |
return next_data
|
| 127 |
|
| 128 |
def process_next_data(self, prompt, separator, category, field, value):
|
|
|
|
| 129 |
if category in self.next_data and field in self.next_data[category]:
|
| 130 |
field_data = self.next_data[category][field]
|
| 131 |
|
|
|
|
| 113 |
def load_next_data(self):
|
| 114 |
next_data = {}
|
| 115 |
next_path = os.path.join("data", "next")
|
| 116 |
+
print(f"Loading next data from: {next_path}")
|
| 117 |
for category in os.listdir(next_path):
|
| 118 |
category_path = os.path.join(next_path, category)
|
| 119 |
if os.path.isdir(category_path):
|
|
|
|
| 121 |
for file in os.listdir(category_path):
|
| 122 |
if file.endswith(".json"):
|
| 123 |
file_path = os.path.join(category_path, file)
|
| 124 |
+
print(f"Loading file: {file_path}")
|
| 125 |
with open(file_path, "r", encoding="utf-8") as f:
|
| 126 |
json_data = json.load(f)
|
| 127 |
next_data[category][file[:-5]] = json_data
|
| 128 |
+
print(f"Loaded next_data: {next_data}")
|
| 129 |
return next_data
|
| 130 |
|
| 131 |
def process_next_data(self, prompt, separator, category, field, value):
|
| 132 |
+
print(f"Processing next data: category={category}, field={field}, value={value}")
|
| 133 |
if category in self.next_data and field in self.next_data[category]:
|
| 134 |
field_data = self.next_data[category][field]
|
| 135 |
|