Spaces:
Build error
Build error
Upload app.py with huggingface_hub
Browse files
app.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi import FastAPI
|
| 2 |
+
from datetime import datetime
|
| 3 |
+
|
| 4 |
+
app = FastAPI(title="AI Agent", version="1.0.0")
|
| 5 |
+
|
| 6 |
+
@app.get("/")
|
| 7 |
+
async def root():
|
| 8 |
+
return {
|
| 9 |
+
"message": "AI Agent Space",
|
| 10 |
+
"status": "running",
|
| 11 |
+
"timestamp": datetime.now().isoformat()
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
@app.get("/health")
|
| 15 |
+
async def health():
|
| 16 |
+
return {"status": "healthy"}
|
| 17 |
+
|
| 18 |
+
@app.get("/agentic")
|
| 19 |
+
async def agentic_test():
|
| 20 |
+
return {
|
| 21 |
+
"reasoning_details": "I am analyzing the task and determining the best approach.",
|
| 22 |
+
"content": "Agentic model is ready for tool use and interleaved thinking.",
|
| 23 |
+
"tool_calls": [
|
| 24 |
+
{
|
| 25 |
+
"id": "test_call_001",
|
| 26 |
+
"function": {
|
| 27 |
+
"name": "search_web",
|
| 28 |
+
"arguments": '{"query": "test search"}'
|
| 29 |
+
}
|
| 30 |
+
}
|
| 31 |
+
],
|
| 32 |
+
"status": "success",
|
| 33 |
+
"thinking_process": "Interleaved thinking enabled"
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
if __name__ == "__main__":
|
| 37 |
+
import uvicorn
|
| 38 |
+
uvicorn.run(app, host="0.0.0.0", port=7860)
|