Download vetcopilot-backend/app/models/transcript.py from WWsCa/VetNet-LCPS: direct link, hf CLI and curl.
- Browser
- Download file 1.58 kB
-
https://huggingface.co/WWsCa/VetNet-LCPS/resolve/main/vetcopilot-backend/app/models/transcript.py
- Command line
-
hf download hf://WWsCa/VetNet-LCPS/vetcopilot-backend/app/models/transcript.py
-
curl -L -o transcript.py https://huggingface.co/WWsCa/VetNet-LCPS/resolve/main/vetcopilot-backend/app/models/transcript.py
1.58 kB
| """ | |
| 转写结果 ORM 模型 | |
| 对应数据库表 transcripts,存储语音转文字的结果(JSON 格式)。 | |
| """ | |
| import uuid | |
| from datetime import datetime | |
| from sqlalchemy import Column, String, Float, DateTime, ForeignKey, Text | |
| from sqlalchemy.orm import relationship | |
| from app.database import Base | |
| class Transcript(Base): | |
| """ | |
| 转写结果表 | |
| 存储语音转文字的完整结果,content 字段为 JSON 字符串, | |
| 包含说话人分离、时间戳、置信度等信息。 | |
| """ | |
| __tablename__ = "transcripts" | |
| # --- 主键 --- | |
| id = Column( | |
| String(36), | |
| primary_key=True, | |
| default=lambda: str(uuid.uuid4()), | |
| comment="转写记录唯一标识(UUID)", | |
| ) | |
| # --- 外键 --- | |
| consultation_id = Column( | |
| String(36), | |
| ForeignKey("consultations.id", ondelete="CASCADE"), | |
| unique=True, | |
| nullable=False, | |
| comment="关联的问诊记录 ID", | |
| ) | |
| # --- 转写内容 --- | |
| # JSON 字符串,结构见 TranscriptSchema | |
| content = Column(Text, nullable=True, default="", comment="转写结果 JSON") | |
| # --- 置信度 --- | |
| confidence = Column(Float, nullable=True, default=0.0, comment="整体置信度(0.0 ~ 1.0)") | |
| # --- 时间戳 --- | |
| created_at = Column(DateTime, default=datetime.now, nullable=False, comment="创建时间") | |
| # --- 关联 --- | |
| consultation = relationship("Consultation", back_populates="transcript") | |
| def __repr__(self): | |
| return f"<Transcript(id={self.id}, consultation_id={self.consultation_id})>" | |