histlearn commited on
Commit
2d000f8
·
verified ·
1 Parent(s): 27813f8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -9,15 +9,19 @@ def load_names_from_url(url):
9
  response = requests.get(url)
10
  data = response.json()
11
 
 
 
12
  names = []
13
- for item in data['@graph']:
14
- if 'name' in item:
15
- names.append(item['name'])
 
 
16
 
17
  return names
18
 
19
  # Carregar nomes do arquivo JSON-LD a partir do URL
20
- names = load_names_from_url('https://huggingface.co/spaces/histlearn/ShowGraph/blob/main/datafile.jsonld')
21
 
22
  def run_query_and_visualize(qtext, turtle_file):
23
  # Carrega o arquivo Turtle
 
9
  response = requests.get(url)
10
  data = response.json()
11
 
12
+ print("Data received from URL:", data) # Adicionando impressão para depuração
13
+
14
  names = []
15
+ for item in data:
16
+ if isinstance(item, dict) and '@graph' in item:
17
+ for entry in item['@graph']:
18
+ if 'name' in entry:
19
+ names.append(entry['name'])
20
 
21
  return names
22
 
23
  # Carregar nomes do arquivo JSON-LD a partir do URL
24
+ names = load_names_from_url('https://huggingface.co/spaces/histlearn/ShowGraph/raw/main/datafile.jsonld')
25
 
26
  def run_query_and_visualize(qtext, turtle_file):
27
  # Carrega o arquivo Turtle