Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
|
|
| 1 |
from llama_cpp import Llama
|
| 2 |
import gradio as gr
|
| 3 |
import os
|
| 4 |
-
from transformers import AutoModel, AutoTokenizer
|
| 5 |
|
| 6 |
os.makedirs("content", exist_ok=True) # Создание директории для сохранения модели
|
| 7 |
|
| 8 |
model_name = "aaditya/OpenBioLLM-Llama3-8B-GGUF"
|
| 9 |
-
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 10 |
-
model = AutoModel.from_pretrained(model_name)
|
| 11 |
model_file = "openbiollm-llama3-8b.Q5_K_M.gguf"
|
| 12 |
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
| 14 |
filename=model_file,
|
| 15 |
local_dir='./content')
|
| 16 |
print("My model path: ", model_path)
|
|
@@ -22,11 +24,10 @@ def my_inference_function(Question):
|
|
| 22 |
response = llm(prompt, max_tokens=4000)['choices'][0]['text']
|
| 23 |
return response
|
| 24 |
|
| 25 |
-
gradio_interface = gr.
|
| 26 |
fn = my_inference_function,
|
| 27 |
inputs = "text",
|
| 28 |
outputs = "text"
|
| 29 |
)
|
| 30 |
|
| 31 |
gradio_interface.launch()
|
| 32 |
-
|
|
|
|
| 1 |
+
from huggingface_hub import hf_hub_download
|
| 2 |
from llama_cpp import Llama
|
| 3 |
import gradio as gr
|
| 4 |
import os
|
| 5 |
+
#from transformers import AutoModel, AutoTokenizer
|
| 6 |
|
| 7 |
os.makedirs("content", exist_ok=True) # Создание директории для сохранения модели
|
| 8 |
|
| 9 |
model_name = "aaditya/OpenBioLLM-Llama3-8B-GGUF"
|
|
|
|
|
|
|
| 10 |
model_file = "openbiollm-llama3-8b.Q5_K_M.gguf"
|
| 11 |
|
| 12 |
+
#tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 13 |
+
#model = AutoModel.from_pretrained(model_name)
|
| 14 |
+
|
| 15 |
+
model_path = hf_hub_download(model_name,
|
| 16 |
filename=model_file,
|
| 17 |
local_dir='./content')
|
| 18 |
print("My model path: ", model_path)
|
|
|
|
| 24 |
response = llm(prompt, max_tokens=4000)['choices'][0]['text']
|
| 25 |
return response
|
| 26 |
|
| 27 |
+
gradio_interface = gr.ChatInterface(
|
| 28 |
fn = my_inference_function,
|
| 29 |
inputs = "text",
|
| 30 |
outputs = "text"
|
| 31 |
)
|
| 32 |
|
| 33 |
gradio_interface.launch()
|
|
|