Spaces:
Runtime error
Runtime error
File size: 488 Bytes
0273ec0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
from fastapi import FastAPI, HTTPException
import faiss
import numpy as np
from sentence_transformers import SentenceTransformer
from datasets import load_dataset
app = FastAPI()
# 1. ์๋ฒ ๋ฉ ๋ชจ๋ธ ๋ก๋
embed_model = SentenceTransformer("all-MiniLM-L6-v2")
# 2. Hugging Face์์ MedRAG ๋ฐ์ดํฐ์
๋ก๋
dataset = load_dataset("MedRAG/textbooks", split="train", streaming=True)
# 3. ๋ฐ์ดํฐ ๋ณํ
texts = [entry["content"] for entry in dataset] # "content" ํ๋ ํ์ฉ
|