Spaces:
Running
Running
Update app.py
Browse files
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("
|
51 |
|
52 |
# π€ Use HuggingFace Inference API (cloud) for LLM
|
53 |
-
HF_MODEL = "deepseek-ai/deepseek-llm-7b-instruct" #
|
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 |
-
|
66 |
-
|
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
|