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