---
# System prepended metadata

title: AI Final Cheat Sheet

---

# AI Final demo cheat sheet
mainly use hugging face API

## Self defined format
Finder Schema
```code=
const finderSchema = new Schema({
    name: { type: String, default: 'Anonymous' },
    contact: { type: String }
});
```
Items Format
```code=
const itemSchema = new Schema({
    description: { type: String, required: true },
    picture: { type: String, required: true }, // the url for the image
    dateLost: { type: Date }, // This can be optional
    locationFound: { type: String },
    status: { type: String, default: 'Unclaimed' }, 
    finder: finderSchema
});
```
## Backend
1. use format defined in frontend to build Schema,
2. APIs

## Frontend
1. Implement function,
2. define data format

## Flow
* Insert
frontend will convert image to URL-->
then backend call hugging face(image to text)-->
return to frontend

* Search
frontend call get ->
backend call hugging face(find close one)
