Upload tool
Browse files- app.py +5 -0
- requirements.txt +1 -0
- tool.py +17 -0
    	
        app.py
    ADDED
    
    | @@ -0,0 +1,5 @@ | |
|  | |
|  | |
|  | |
|  | |
|  | 
|  | |
| 1 | 
            +
            from smolagents import launch_gradio_demo
         | 
| 2 | 
            +
            from tool import SimpleTool
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            tool = SimpleTool()
         | 
| 5 | 
            +
            launch_gradio_demo(tool)
         | 
    	
        requirements.txt
    ADDED
    
    | @@ -0,0 +1 @@ | |
|  | 
|  | |
| 1 | 
            +
            smolagents
         | 
    	
        tool.py
    ADDED
    
    | @@ -0,0 +1,17 @@ | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | 
|  | |
| 1 | 
            +
            from smolagents import Tool
         | 
| 2 | 
            +
            from typing import Any, Optional
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            class SimpleTool(Tool):
         | 
| 5 | 
            +
                name = "simple_tool"
         | 
| 6 | 
            +
                description = "A simple test tool."
         | 
| 7 | 
            +
                inputs = {"text":{"type":"string","description":"Some input text"}}
         | 
| 8 | 
            +
                output_type = "string"
         | 
| 9 | 
            +
             | 
| 10 | 
            +
                def forward(self, text: str) -> str:
         | 
| 11 | 
            +
                    """
         | 
| 12 | 
            +
                    A simple test tool.
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                    Args:
         | 
| 15 | 
            +
                        text: Some input text
         | 
| 16 | 
            +
                    """
         | 
| 17 | 
            +
                    return f"Processed: {text}"
         | 
