[Python] 如何使用 FastAPI 支援的自動生成文件(包含輸出靜態文件)
介紹
在 FastAPI 官方文件中,有一段關於『自動生成交互式文件』的說明:
- Robust: Get production-ready code. With automatic interactive documentation.
在 FastAPI 官方文件中,有一段關於『自動生成交互式文件』的說明:
yield
是 Python 中的一個關鍵字,它的使用場景與 return
很像,不過使用 yield
會把函式變成一個生成器(generator)。
FastAPI 是一個現代、高效的 Python web 框架。基於 python 3.7+ 並且擁有 python type hints。
Read More »[Python] 使用 FastAPI 框架進行後端開發筆記前陣子閱讀了不少 LLaMA 的各種 LoRA 模型訓練(雖然已經大概是兩個月前...),在閱讀各家程式碼的時候,發現在程式碼中設定給予模型的 prompt 時,若需要根據不同的資料調整內容,使用 format_map()
的格式看起來最為乾淨。
Moderation 模型是一個 OpenAI 所提供的免費工具,用來審查所謂的『不適當內容』。詳細的禁止條例可以參考 https://openai.com/policies/usage-policies。
Read More »使用 OpenAI Moderation Endpoint 偵測不適當內容Given a directed acyclic graph, with n
vertices numbered from 0
to n-1
, and an array edges
where edges[i] = [fromi, toi]
represents a directed edge from node fromi
to node toi
.
Faiss 是 Facebook AI Research 團隊所開發的一款高效向量匹配函式庫,只要輸入向量後,就能夠在大量的高維度向量中迅速匹配最相像的 top k 個向量。
Read More »[Python] 使用 Faiss 相似度搜索快速匹配向量Given two 0-indexed integer arrays nums1
and nums2
, return a list answer
of size 2
where:
answer[0]
is a list of all distinct integers in nums1
which are not present in nums2
.answer[1]
is a list of all distinct integers in nums2
which are not present in nums1
.There is a function signFunc(x)
that returns: