Spaces:
Sleeping
Sleeping
Download models/generated_image.py from dev-haresh/nexus-ai: direct link, hf CLI and curl.
- Browser
- Download file 814 Bytes
-
https://huggingface.co/spaces/dev-haresh/nexus-ai/resolve/main/models/generated_image.py
- Command line
-
hf download hf://spaces/dev-haresh/nexus-ai/models/generated_image.py
-
curl -L -o generated_image.py https://huggingface.co/spaces/dev-haresh/nexus-ai/resolve/main/models/generated_image.py
814 Bytes
| from database import db | |
| from datetime import datetime, timezone | |
| class GeneratedImage(db.Model): | |
| __tablename__ = "generated_images" | |
| id = db.Column(db.Integer, primary_key=True) | |
| user_id = db.Column(db.Integer, db.ForeignKey("users.id", ondelete="CASCADE"), nullable=False, index=True) | |
| prompt = db.Column(db.Text, nullable=False) | |
| model = db.Column(db.String(50), default="openrouter") | |
| path = db.Column(db.String(500), nullable=False) | |
| created_at = db.Column(db.DateTime, default=lambda: datetime.now(timezone.utc), index=True) | |
| def to_dict(self): | |
| return { | |
| "id": self.id, | |
| "prompt": self.prompt, | |
| "model": self.model, | |
| "path": self.path, | |
| "created_at": self.created_at.isoformat() if self.created_at else None | |
| } | |