File size: 742 Bytes
8fe7f88
95c280d
c87a61e
 
8fe7f88
 
 
 
 
 
 
 
 
c87a61e
 
 
 
 
 
 
 
95c280d
8fe7f88
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import requests
import os
repo_dir = os.getcwd()
print(repo_dir)

def show_examples(n = 10):

    url = f"https://datasets-server.huggingface.co/rows?dataset=jjzha%2Fskillspan&config=default&split=train&offset=0&length={n}"
    response = requests.get(url)

    if response.status_code == 200:

        data = response.json()

        tags_knowledge = [str(a['row']['tags_knowledge']) for a in data['rows']]
        tokens = [str(a['row']['tokens']) for a in data['rows']]

        with open(f"{repo_dir}/few_shot.txt", 'w') as file:
            for i in range(n):
                file.write(f'tags_knowledge: {tags_knowledge[i]}\n')
                file.write(f'tokens: {tokens[i]}\n')
                file.write('\n')


show_examples(n=100)