Spaces:
Runtime error
Runtime error
Download src/models/dtos/vectors/keyframes/mod.rs from variphx/aic-server: direct link, hf CLI and curl.
- Browser
- Download file 880 Bytes
-
https://huggingface.co/spaces/variphx/aic-server/resolve/main/src/models/dtos/vectors/keyframes/mod.rs
- Command line
-
hf download hf://spaces/variphx/aic-server/src/models/dtos/vectors/keyframes/mod.rs
-
curl -L -o mod.rs https://huggingface.co/spaces/variphx/aic-server/resolve/main/src/models/dtos/vectors/keyframes/mod.rs
880 Bytes
| use qdrant_client::qdrant::{ScoredPoint, point_id::PointIdOptions}; | |
| mod requests; | |
| pub use requests::VectorizedKeyframeRequestDto; | |
| pub struct VectorizedKeyframeDto { | |
| id: u64, | |
| score: f32, | |
| } | |
| impl TryFrom<ScoredPoint> for VectorizedKeyframeDto { | |
| type Error = anyhow::Error; | |
| fn try_from(value: ScoredPoint) -> Result<Self, Self::Error> { | |
| Ok(Self { | |
| id: value | |
| .id | |
| .and_then(|x| x.point_id_options) | |
| .and_then(|x| { | |
| if let PointIdOptions::Num(x) = x { | |
| Some(x) | |
| } else { | |
| None | |
| } | |
| }) | |
| .ok_or_else(|| anyhow::anyhow!("scored point should have id"))?, | |
| score: value.score, | |
| }) | |
| } | |
| } | |