baconnier commited on
Commit
f2019db
·
verified ·
1 Parent(s): 910154a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -15
app.py CHANGED
@@ -248,14 +248,8 @@ Response must be valid JSON with this structure:
248
  """
249
  return html_content
250
 
251
- @gr.cache_examples
252
- def explore(
253
- query: str,
254
- path_history: str = "[]",
255
- parameters: str = "{}",
256
- depth: int = 5,
257
- domain: str = ""
258
- ) -> Tuple[str, str, str]:
259
  """Generate exploration path and visualization"""
260
  try:
261
  # Initialize generator
@@ -272,11 +266,9 @@ def explore(
272
  except json.JSONDecodeError as e:
273
  raise ValueError(f"Invalid JSON input: {str(e)}")
274
 
275
- # Add domain and depth to parameters
276
- exploration_parameters.update({
277
- "domain": domain,
278
- "depth": depth
279
- })
280
 
281
  # Generate result
282
  result = generator.generate_exploration_path(
@@ -286,7 +278,7 @@ def explore(
286
  )
287
 
288
  # Create visualization
289
- graph_html = ExplorationPathGenerator.create_interactive_graph(result.get('nodes', []))
290
 
291
  # Initial summary
292
  summary = "Click on nodes in the graph to see detailed information"
@@ -294,7 +286,6 @@ def explore(
294
  return json.dumps(result), graph_html, summary
295
 
296
  except Exception as e:
297
- logger.error(f"Error in explore function: {e}")
298
  error_response = {
299
  "error": str(e),
300
  "status": "failed",
 
248
  """
249
  return html_content
250
 
251
+ # Remove the @gr.cache_examples decorator since it's not supported
252
+ def explore(query: str, path_history: str = "[]", parameters: str = "{}", depth: int = 5, domain: str = "") -> tuple:
 
 
 
 
 
 
253
  """Generate exploration path and visualization"""
254
  try:
255
  # Initialize generator
 
266
  except json.JSONDecodeError as e:
267
  raise ValueError(f"Invalid JSON input: {str(e)}")
268
 
269
+ # Add domain to parameters if provided
270
+ if domain:
271
+ exploration_parameters["domain"] = domain
 
 
272
 
273
  # Generate result
274
  result = generator.generate_exploration_path(
 
278
  )
279
 
280
  # Create visualization
281
+ graph_html = create_interactive_graph(result.get('nodes', []))
282
 
283
  # Initial summary
284
  summary = "Click on nodes in the graph to see detailed information"
 
286
  return json.dumps(result), graph_html, summary
287
 
288
  except Exception as e:
 
289
  error_response = {
290
  "error": str(e),
291
  "status": "failed",