Spaces:
Sleeping
Sleeping
Upload 2 files
Browse files- herbal_expert.py +3 -2
- requirements.txt +1 -0
herbal_expert.py
CHANGED
@@ -17,6 +17,7 @@ Entrez.email = "[email protected]"
|
|
17 |
from langchain.callbacks.manager import CallbackManagerForLLMRun
|
18 |
from typing import List, Union, Optional, Any
|
19 |
|
|
|
20 |
|
21 |
class CustomLLM(LLM):
|
22 |
n: int
|
@@ -42,7 +43,7 @@ class CustomLLM(LLM):
|
|
42 |
"stop": ["### Instruction:"], "temperature": 0, "max_tokens": 512, "stream": False
|
43 |
}
|
44 |
|
45 |
-
response = requests.post("
|
46 |
headers={"Content-Type": "application/json"}, json=data)
|
47 |
return json.loads(response.text)['choices'][0]['message']['content']
|
48 |
|
@@ -165,7 +166,7 @@ def call_model_with_history(messages: list):
|
|
165 |
"stop": ["### Instruction:"], "temperature": 0, "max_tokens": 512, "stream": False
|
166 |
}
|
167 |
|
168 |
-
response = requests.post("
|
169 |
return json.loads(response.text)['choices'][0]['message']['content']
|
170 |
|
171 |
|
|
|
17 |
from langchain.callbacks.manager import CallbackManagerForLLMRun
|
18 |
from typing import List, Union, Optional, Any
|
19 |
|
20 |
+
ngrok_url = 'https://2590-2605-7b80-3d-320-a515-4f0d-f60e-71e5.ngrok-free.app/'
|
21 |
|
22 |
class CustomLLM(LLM):
|
23 |
n: int
|
|
|
43 |
"stop": ["### Instruction:"], "temperature": 0, "max_tokens": 512, "stream": False
|
44 |
}
|
45 |
|
46 |
+
response = requests.post(ngrok_url + "v1/chat/completions",
|
47 |
headers={"Content-Type": "application/json"}, json=data)
|
48 |
return json.loads(response.text)['choices'][0]['message']['content']
|
49 |
|
|
|
166 |
"stop": ["### Instruction:"], "temperature": 0, "max_tokens": 512, "stream": False
|
167 |
}
|
168 |
|
169 |
+
response = requests.post(ngrok_url+ "v1/chat/completions", headers={"Content-Type": "application/json"}, json=data)
|
170 |
return json.loads(response.text)['choices'][0]['message']['content']
|
171 |
|
172 |
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
streamlit_authenticator
|