Spaces:
Sleeping
Sleeping
vkrishnan569
commited on
Commit
•
3280898
1
Parent(s):
91aabf8
Server Deployment
Browse files- Dockerfile +1 -1
- main.py +1 -0
- model.py +21 -0
- requirements.txt +1 -1
Dockerfile
CHANGED
@@ -8,4 +8,4 @@ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
|
8 |
|
9 |
COPY . .
|
10 |
|
11 |
-
CMD ["gunicorn", "-b", "0.0.0.0:7860","
|
|
|
8 |
|
9 |
COPY . .
|
10 |
|
11 |
+
CMD ["gunicorn", "-b", "0.0.0.0:7860","model:app"]
|
main.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
from flask import Flask, request, jsonify
|
2 |
from llama_cpp import Llama
|
|
|
3 |
|
4 |
# Initialize the Llama model with chat format set to "llama-2"
|
5 |
llm = Llama(model_path="E:/langchain-chat-gui-main/langchain-chat-gui-main/llama-2-7b-chat.Q2_K.gguf", chat_format="llama-2")
|
|
|
1 |
from flask import Flask, request, jsonify
|
2 |
from llama_cpp import Llama
|
3 |
+
from huggingface_hub import hf_hub_download
|
4 |
|
5 |
# Initialize the Llama model with chat format set to "llama-2"
|
6 |
llm = Llama(model_path="E:/langchain-chat-gui-main/langchain-chat-gui-main/llama-2-7b-chat.Q2_K.gguf", chat_format="llama-2")
|
model.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from huggingface_hub import hf_hub_download
|
2 |
+
|
3 |
+
# Define the repository ID (username/repository_name)
|
4 |
+
repo_id = 'TheBloke/Llama-2-7B-Chat-GGUF'
|
5 |
+
|
6 |
+
# Define the filename you want to download
|
7 |
+
filename = 'llama-2-7b-chat.Q2_K.gguf'
|
8 |
+
|
9 |
+
# Define the cache directory (optional)
|
10 |
+
# If not provided, the default cache directory will be used
|
11 |
+
cache_dir = './path_to_cache_directory'
|
12 |
+
|
13 |
+
# Download the file
|
14 |
+
file_path = hf_hub_download(
|
15 |
+
repo_id=repo_id,
|
16 |
+
filename=filename,
|
17 |
+
cache_dir=cache_dir
|
18 |
+
)
|
19 |
+
|
20 |
+
# The file_path variable now contains the local path to the downloaded file
|
21 |
+
print(f"File downloaded to: {file_path}")
|
requirements.txt
CHANGED
@@ -10,4 +10,4 @@ MarkupSafe==2.1.5
|
|
10 |
numpy==1.26.4
|
11 |
typing_extensions==4.11.0
|
12 |
Werkzeug==3.0.3
|
13 |
-
|
|
|
10 |
numpy==1.26.4
|
11 |
typing_extensions==4.11.0
|
12 |
Werkzeug==3.0.3
|
13 |
+
huggingface_hub
|