VirtualOasis commited on
Commit
3283abf
·
verified ·
1 Parent(s): cfa2282

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -17
app.py CHANGED
@@ -376,32 +376,49 @@ try:
376
  3. 🕸️ Builds and visualizes knowledge graphs
377
  4. 📊 Provides detailed analysis summaries
378
 
379
- **Examples to try:**
380
- - News articles, Wikipedia pages, or any text content
381
  """,
382
- examples=[
383
- ["Artificial intelligence companies like OpenAI, Google, and Microsoft are developing large language models for various applications."],
384
- ["https://en.wikipedia.org/wiki/Machine_learning"],
385
- ],
386
  theme=gr.themes.Soft(),
387
- allow_flagging="never"
 
388
  )
389
 
390
- if __name__ == "__main__":
391
- demo.launch(mcp_server=True, share=False)
392
-
393
  except Exception as e:
394
  print(f"Failed to create Gradio interface: {e}")
395
  # Create a simple fallback interface
396
  def simple_demo(text):
397
- return f"Error: {e}", None, "Application failed to start properly."
398
 
399
  demo = gr.Interface(
400
  fn=simple_demo,
401
- inputs="text",
402
- outputs=["text", "image", "text"],
403
- title="Error - Knowledge Graph Builder"
 
 
 
 
 
 
404
  )
405
-
406
- if __name__ == "__main__":
407
- demo.launch(mcp_server=True, share=False)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
376
  3. 🕸️ Builds and visualizes knowledge graphs
377
  4. 📊 Provides detailed analysis summaries
378
 
379
+ **Try with:** news articles, Wikipedia pages, or any text content
 
380
  """,
 
 
 
 
381
  theme=gr.themes.Soft(),
382
+ allow_flagging="never",
383
+ cache_examples=False # Disable example caching to prevent startup errors
384
  )
385
 
 
 
 
386
  except Exception as e:
387
  print(f"Failed to create Gradio interface: {e}")
388
  # Create a simple fallback interface
389
  def simple_demo(text):
390
+ return json.dumps({"error": f"Startup failed: {str(e)}"}), None, "Application failed to start properly."
391
 
392
  demo = gr.Interface(
393
  fn=simple_demo,
394
+ inputs=[gr.Textbox(label="Input", placeholder="Enter text...")],
395
+ outputs=[
396
+ gr.JSON(label="Error Output"),
397
+ gr.Image(label="No Image"),
398
+ gr.Markdown(label="Error Message")
399
+ ],
400
+ title="⚠️ Knowledge Graph Builder - Startup Error",
401
+ allow_flagging="never",
402
+ cache_examples=False
403
  )
404
+
405
+ # Launch the demo
406
+ if __name__ == "__main__":
407
+ try:
408
+ demo.launch(
409
+ mcp_server=True,
410
+ share=False,
411
+ show_error=True,
412
+ quiet=False
413
+ )
414
+ except Exception as e:
415
+ print(f"Launch failed: {e}")
416
+ # Try without MCP server as fallback
417
+ try:
418
+ demo.launch(
419
+ mcp_server=False,
420
+ share=False,
421
+ show_error=True
422
+ )
423
+ except Exception as e2:
424
+ print(f"Complete failure: {e2}")