limyehji commited on
Commit
0273ec0
ยท
verified ยท
1 Parent(s): 6edb449

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -0
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" ํ•„๋“œ ํ™œ์šฉ