VirtualOasis commited on
Commit
78b1724
·
verified ·
1 Parent(s): 7c56cb5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -20
app.py CHANGED
@@ -199,15 +199,9 @@ def build_knowledge_graph(input_text):
199
  "knowledge_graph": None
200
  }
201
 
202
- # Create wrapper function for proper JSON formatting in UI
203
- def build_knowledge_graph_ui(input_text):
204
- """Wrapper function that returns JSON string for UI display."""
205
- result = build_knowledge_graph(input_text)
206
- return json.dumps(result, indent=2, ensure_ascii=False)
207
-
208
  # Create Gradio interface
209
  demo = gr.Interface(
210
- fn=build_knowledge_graph_ui,
211
  inputs=gr.Textbox(
212
  label="Text or URL Input",
213
  placeholder="Enter text to analyze or a web URL (e.g., https://example.com)",
@@ -235,17 +229,4 @@ demo = gr.Interface(
235
  theme=gr.themes.Soft()
236
  )
237
 
238
- # Register MCP tools
239
- demo.mcp.register_tool(
240
- "build_knowledge_graph",
241
- build_knowledge_graph,
242
- "Build knowledge graph from text or URL",
243
- {
244
- "input_text": {
245
- "type": "string",
246
- "description": "Text content or URL to analyze and extract knowledge graph from"
247
- }
248
- }
249
- )
250
-
251
  demo.launch(mcp_server=True)
 
199
  "knowledge_graph": None
200
  }
201
 
 
 
 
 
 
 
202
  # Create Gradio interface
203
  demo = gr.Interface(
204
+ fn=build_knowledge_graph,
205
  inputs=gr.Textbox(
206
  label="Text or URL Input",
207
  placeholder="Enter text to analyze or a web URL (e.g., https://example.com)",
 
229
  theme=gr.themes.Soft()
230
  )
231
 
 
 
 
 
 
 
 
 
 
 
 
 
 
232
  demo.launch(mcp_server=True)