Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,21 +1,4 @@
|
|
1 |
-
|
2 |
-
from faiss import write_index
|
3 |
-
import gradio as gr
|
4 |
-
import numpy as np
|
5 |
-
import torch
|
6 |
-
from tqdm import tqdm
|
7 |
-
from torch.utils.data import DataLoader, Dataset
|
8 |
-
from datasets import load_dataset
|
9 |
-
import pandas as pd
|
10 |
-
import faiss
|
11 |
-
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig, AutoModel
|
12 |
-
from transformers import TextIteratorStreamer
|
13 |
-
from threading import Thread
|
14 |
-
|
15 |
-
torch.set_num_threads(2)
|
16 |
-
HF_TOKEN = os.environ.get("SECRET_TOKEN")
|
17 |
-
|
18 |
-
|
19 |
# OBTENER EL DATASET________________________________________________________________________________
|
20 |
def get_medical_flashcards_dataset():
|
21 |
"""
|
@@ -337,7 +320,23 @@ def answer_query(query_text, index, documents, llm_model, llm_tokenizer, embeddi
|
|
337 |
|
338 |
|
339 |
if __name__ == '__main__':
|
340 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
341 |
class CFG:
|
342 |
embedding_model = 'TimKond/S-PubMedBert-MedQuAD'
|
343 |
batch_size = 128
|
@@ -382,3 +381,5 @@ if __name__ == '__main__':
|
|
382 |
description = "Gemma 2b Medical Chatbot is a chatbot that can help you with your medical queries. It is not a replacement for a doctor. Please consult a doctor for any medical advice.",
|
383 |
)
|
384 |
demo.launch()
|
|
|
|
|
|
1 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
# OBTENER EL DATASET________________________________________________________________________________
|
3 |
def get_medical_flashcards_dataset():
|
4 |
"""
|
|
|
320 |
|
321 |
|
322 |
if __name__ == '__main__':
|
323 |
+
import os
|
324 |
+
from faiss import write_index
|
325 |
+
import gradio as gr
|
326 |
+
import numpy as np
|
327 |
+
import torch
|
328 |
+
from tqdm import tqdm
|
329 |
+
from torch.utils.data import DataLoader, Dataset
|
330 |
+
from datasets import load_dataset
|
331 |
+
import pandas as pd
|
332 |
+
import faiss
|
333 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig, AutoModel
|
334 |
+
from transformers import TextIteratorStreamer
|
335 |
+
from threading import Thread
|
336 |
+
|
337 |
+
torch.set_num_threads(2)
|
338 |
+
HF_TOKEN = os.environ.get("SECRET_TOKEN")
|
339 |
+
|
340 |
class CFG:
|
341 |
embedding_model = 'TimKond/S-PubMedBert-MedQuAD'
|
342 |
batch_size = 128
|
|
|
381 |
description = "Gemma 2b Medical Chatbot is a chatbot that can help you with your medical queries. It is not a replacement for a doctor. Please consult a doctor for any medical advice.",
|
382 |
)
|
383 |
demo.launch()
|
384 |
+
|
385 |
+
|