Spaces:
Sleeping
Sleeping
| # Your detailed YouTube analysis app.py content | |
| import gradio as gr | |
| from pytube import YouTube | |
| # ... more of your code ... | |
| youtube_tool_interface.launch(mcp_server=True) | |
| # app.py | |
| # ... (your imports and function definitions for analyze_youtube_content) ... | |
| youtube_tool_interface = gr.Interface( | |
| fn=analyze_youtube_content, | |
| inputs=[ | |
| gr.Textbox(label="YouTube Video URL (Optional)", placeholder="Enter YouTube video URL..."), | |
| gr.Textbox(label="Video Transcript Text (Optional)", placeholder="Paste video transcript here...", lines=5) | |
| ], | |
| outputs=gr.JSON(label="Analysis Result"), | |
| title="YouTube Content Analyzer Tool", | |
| description="Provides information and sentiment analysis for a YouTube video URL or its transcript. (For Agent Use via MCP)" | |
| ) | |
| if __name__ == "__main__": | |
| logging.info("Launching Gradio app with MCP server enabled for the YouTube Content Analyzer Tool...") | |
| # The `mcp_server=True` flag is crucial for the agent to connect and use the tool. | |
| youtube_tool_interface.launch(mcp_server=True) # <<< MAKE SURE THIS IS CORRECT | |