tdecae commited on
Commit
5ed3b00
Β·
verified Β·
1 Parent(s): 57faddd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -47,10 +47,10 @@ vectorstore.persist()
47
  # πŸ” Get HF token from env variable
48
  HF_API_KEY = os.getenv("HF_API_KEY")
49
  if HF_API_KEY is None:
50
- raise ValueError("HUGGINGFACE_API_KEY environment variable is not set.")
51
 
52
  # πŸ€– Use HuggingFace Inference API (cloud) for LLM
53
- HF_MODEL = "deepseek-ai/deepseek-llm-7b-instruct" # you can change this to another model if you like
54
  client = InferenceClient(token=HF_API_KEY)
55
 
56
  # πŸ”· Wrap HF client into LangChain LLM interface
@@ -62,8 +62,8 @@ class HuggingFaceInferenceLLM(LLM):
62
 
63
  def _call(self, prompt, stop=None, run_manager=None, **kwargs):
64
  response = self.client.text_generation(
65
- model=self.model,
66
- inputs=prompt,
67
  max_new_tokens=512,
68
  temperature=0.7,
69
  do_sample=True,
@@ -104,4 +104,4 @@ with gr.Blocks() as demo:
104
  msg.submit(user, [msg, chatbot], [msg, chatbot], queue=False)
105
  clear.click(lambda: None, None, chatbot, queue=False)
106
 
107
- demo.launch(debug=True)
 
47
  # πŸ” Get HF token from env variable
48
  HF_API_KEY = os.getenv("HF_API_KEY")
49
  if HF_API_KEY is None:
50
+ raise ValueError("HF_API_KEY environment variable is not set.")
51
 
52
  # πŸ€– Use HuggingFace Inference API (cloud) for LLM
53
+ HF_MODEL = "deepseek-ai/deepseek-llm-7b-instruct" # change if desired
54
  client = InferenceClient(token=HF_API_KEY)
55
 
56
  # πŸ”· Wrap HF client into LangChain LLM interface
 
62
 
63
  def _call(self, prompt, stop=None, run_manager=None, **kwargs):
64
  response = self.client.text_generation(
65
+ self.model,
66
+ prompt,
67
  max_new_tokens=512,
68
  temperature=0.7,
69
  do_sample=True,
 
104
  msg.submit(user, [msg, chatbot], [msg, chatbot], queue=False)
105
  clear.click(lambda: None, None, chatbot, queue=False)
106
 
107
+ demo.launch(debug=True, share=True) # share=True gives you a public link