Download main.py from SHIVANSHD/MEH: direct link, hf CLI and curl.
- Browser
- Download file 840 Bytes
-
https://huggingface.co/spaces/SHIVANSHD/MEH/resolve/main/main.py
- Command line
-
hf download hf://spaces/SHIVANSHD/MEH/main.py
-
curl -L -o main.py https://huggingface.co/spaces/SHIVANSHD/MEH/resolve/main/main.py
840 Bytes
| from fastapi import FastAPI, HTTPException | |
| from pydantic import BaseModel | |
| from typing import Dict, Any | |
| import json, uuid, random, os | |
| app = FastAPI(title="Personal Social Memory Agent", version="1.0.0") | |
| DATA_PATH = os.path.join(os.path.dirname(__file__), "data", "sample_data.json") | |
| if not os.path.exists(DATA_PATH): | |
| os.makedirs(os.path.dirname(DATA_PATH), exist_ok=True) | |
| with open(DATA_PATH, 'w') as df: | |
| json.dump({"posts": [], "threads": [], "chats": []}, df) | |
| with open(DATA_PATH) as f: | |
| DATA = json.load(f) | |
| def root(): return {"Status": "Active"} | |
| async def reset(): | |
| return {"episode_id": str(uuid.uuid4()), "observation": "Data loaded.", "done": False} | |
| async def step(data: dict): | |
| return {"reward": 1.0, "done": True, "observation": "Task complete."} | |