DebabrataHalder commited on
Commit
86b7c7d
·
verified ·
1 Parent(s): 3fdb9fc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -4
app.py CHANGED
@@ -1,11 +1,23 @@
 
1
  import gradio as gr
2
  from llama_cpp import Llama
 
3
 
4
- # Load the model directly from your Hugging Face repository
5
- llm = Llama.from_pretrained(
6
  repo_id="DebabrataHalder/mysqlmodel",
7
- filename="mysqlmodel.gguf",
8
- n_ctx=2048 # adjust context size if needed
 
 
 
 
 
 
 
 
 
 
9
  )
10
 
11
  def chat(prompt):
@@ -23,3 +35,4 @@ iface = gr.Interface(
23
  )
24
 
25
  iface.launch()
 
 
1
+ import os
2
  import gradio as gr
3
  from llama_cpp import Llama
4
+ from huggingface_hub import snapshot_download
5
 
6
+ # Download the model repository locally with a long timeout (in seconds)
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 downloaded local repository
16
+ llm = Llama.from_pretrained(
17
+ repo_id=local_repo, # now a local folder path
18
+ filename="mysqlmodel.gguf", # the GGUF file to load
19
+ n_ctx=2048, # adjust context size as needed
20
+ local_files_only=True # do not attempt remote file listing
21
  )
22
 
23
  def chat(prompt):
 
35
  )
36
 
37
  iface.launch()
38
+