Download Fragmentation.py from AGofficial/AgGPT-12Pro: direct link, hf CLI and curl.
- Browser
- Download file 640 Bytes
-
https://huggingface.co/AGofficial/AgGPT-12Pro/resolve/main/Fragmentation.py
- Command line
-
hf download hf://AGofficial/AgGPT-12Pro/Fragmentation.py
-
curl -L -o Fragmentation.py https://huggingface.co/AGofficial/AgGPT-12Pro/resolve/main/Fragmentation.py
640 Bytes
| import random | |
| class Crystal(): | |
| def __init__(self): | |
| pass | |
| def GetFragments(self, num_results=5): | |
| fragments = "" | |
| with open('data.crystal', 'r') as file: | |
| lines = file.readlines() | |
| selected_lines = random.sample(lines, min(num_results, len(lines))) | |
| fragments = ''.join(selected_lines) | |
| return fragments | |
| def SaveNewFragment(self, fragment): | |
| with open('data.crystal', 'a') as file: | |
| file.write(fragment + '\n') | |
| if __name__ == "__main__": | |
| crystal = Crystal() | |
| fragments = crystal.GetFragments(num_results=3) | |
| print(fragments) |