histlearn commited on
Commit
547cf18
·
verified ·
1 Parent(s): 2d000f8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -23,6 +23,8 @@ def load_names_from_url(url):
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
28
  g = rdflib.Graph()
@@ -64,7 +66,10 @@ with gr.Blocks() as demo:
64
 
65
  with gr.Column():
66
  selected_location = gr.Dropdown(choices=names, label="Selecione o Local")
67
- query_input = gr.Textbox(label="Consulta SPARQL", value=update_query(names[0]), lines=10)
 
 
 
68
  turtle_file_input = gr.File(label="Arquivo Turtle")
69
  run_button = gr.Button("Executar Consulta")
70
 
 
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
+ print("Loaded names:", names) # Adicionando impressão para depuração
27
+
28
  def run_query_and_visualize(qtext, turtle_file):
29
  # Carrega o arquivo Turtle
30
  g = rdflib.Graph()
 
66
 
67
  with gr.Column():
68
  selected_location = gr.Dropdown(choices=names, label="Selecione o Local")
69
+ if names: # Verifica se a lista de nomes não está vazia
70
+ query_input = gr.Textbox(label="Consulta SPARQL", value=update_query(names[0]), lines=10)
71
+ else:
72
+ query_input = gr.Textbox(label="Consulta SPARQL", value="", lines=10)
73
  turtle_file_input = gr.File(label="Arquivo Turtle")
74
  run_button = gr.Button("Executar Consulta")
75