Spaces:
Sleeping
Sleeping
File size: 1,490 Bytes
300cc8d 9adba36 8851723 b9f5d20 8851723 300cc8d 7b971c7 300cc8d b9f5d20 300cc8d 9adba36 300cc8d 2c68df4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
from huggingface_hub import hf_hub_download
from llama_cpp import Llama
import gradio as gr
import os
os.makedirs(/content, exist_ok=True) # Создание директории для сохранения модели
model_name = "aaditya/OpenBioLLM-Llama3-8B-GGUF"
model_file = "openbiollm-llama3-8b.Q5_K_M.gguf"
model_path = hf_hub_download(model_name,
filename=model_file,
local_dir='/content')
print("My model path: ", model_path)
llm = Llama(model_path=model_path,
n_gpu_layers=-1)
def my_inference_function(Question):
prompt = f"You are an expert and experienced from the healthcare and biomedical domain with extensive medical knowledge and practical experience. Your name is OpenBioLLM, and you were developed by Saama AI Labs with Open Life Science AI. who's willing to help answer the user's query with explanation. In your explanation, leverage your deep medical expertise such as relevant anatomical structures, physiological processes, diagnostic criteria, treatment guidelines, or other pertinent medical concepts. Use precise medical terminology while still aiming to make the explanation clear and accessible to a general audience. Medical Question: {Question} Medical Answer:"
response = llm(prompt, max_tokens=4000)['choices'][0]['text']
return response
gradio_interface = gradio.Interface(
fn = my_inference_function,
inputs = "text",
outputs = "text"
)
gradio_interface.launch()
|