Spaces:
Build error
Build error
| from sqlalchemy import Column, Integer, String, JSON, DateTime, Float | |
| from sqlalchemy.ext.declarative import declarative_base | |
| from sqlalchemy.orm import sessionmaker | |
| import datetime | |
| SQLALCHEMY_DATABASE_URL = "sqlite:///./sql_app.db" | |
| from sqlalchemy import create_engine | |
| engine = create_engine(SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False}) | |
| SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine) | |
| Base = declarative_base() | |
| class AnalysisResult(Base): | |
| __tablename__ = "analysis_results" | |
| id = Column(String, primary_key=True, index=True) | |
| filename = Column(String) | |
| created_at = Column(DateTime, default=datetime.datetime.utcnow) | |
| # Raw Analysis Data | |
| text_analysis = Column(JSON, nullable=True) | |
| image_analysis = Column(JSON, nullable=True) | |
| audio_analysis = Column(JSON, nullable=True) | |
| # Multimodal Insights | |
| multimodal_insights = Column(JSON, nullable=True) | |
| overall_score = Column(Float, nullable=True) | |
| Base.metadata.create_all(bind=engine) | |
| def get_db(): | |
| db = SessionLocal() | |
| try: | |
| yield db | |
| finally: | |
| db.close() | |