Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,21 +3,23 @@ import gradio as gr
|
|
| 3 |
from llama_cpp import Llama
|
| 4 |
from huggingface_hub import snapshot_download
|
| 5 |
|
| 6 |
-
#
|
|
|
|
|
|
|
|
|
|
| 7 |
local_repo = snapshot_download(
|
| 8 |
repo_id="DebabrataHalder/mysqlmodel",
|
| 9 |
revision="main",
|
| 10 |
local_dir_use_symlinks=False,
|
| 11 |
-
resume_download=True
|
| 12 |
-
timeout=3600 # wait up to one hour for the download to complete
|
| 13 |
)
|
| 14 |
|
| 15 |
-
# Load the model from the
|
| 16 |
llm = Llama.from_pretrained(
|
| 17 |
-
repo_id=local_repo, #
|
| 18 |
-
filename="mysqlmodel.gguf", # the GGUF file
|
| 19 |
-
n_ctx=2048, # adjust context size
|
| 20 |
-
local_files_only=True #
|
| 21 |
)
|
| 22 |
|
| 23 |
def chat(prompt):
|
|
@@ -36,3 +38,4 @@ iface = gr.Interface(
|
|
| 36 |
|
| 37 |
iface.launch()
|
| 38 |
|
|
|
|
|
|
| 3 |
from llama_cpp import Llama
|
| 4 |
from huggingface_hub import snapshot_download
|
| 5 |
|
| 6 |
+
# Optionally, set a high timeout environment variable (if your HF Hub version honors this)
|
| 7 |
+
os.environ["HF_HUB_HTTP_TIMEOUT"] = "3600" # 1 hour in seconds
|
| 8 |
+
|
| 9 |
+
# Download the model repository locally; this will block until the download completes
|
| 10 |
local_repo = snapshot_download(
|
| 11 |
repo_id="DebabrataHalder/mysqlmodel",
|
| 12 |
revision="main",
|
| 13 |
local_dir_use_symlinks=False,
|
| 14 |
+
resume_download=True
|
|
|
|
| 15 |
)
|
| 16 |
|
| 17 |
+
# Load the model from the local repository
|
| 18 |
llm = Llama.from_pretrained(
|
| 19 |
+
repo_id=local_repo, # local folder path now
|
| 20 |
+
filename="mysqlmodel.gguf", # the GGUF file name
|
| 21 |
+
n_ctx=2048, # adjust context size if needed
|
| 22 |
+
local_files_only=True # force local file loading
|
| 23 |
)
|
| 24 |
|
| 25 |
def chat(prompt):
|
|
|
|
| 38 |
|
| 39 |
iface.launch()
|
| 40 |
|
| 41 |
+
|