moamen270 commited on
Commit
0195065
1 Parent(s): 67fb2b5

Create endpoints.py

Browse files
Files changed (1) hide show
  1. endpoints.py +13 -0
endpoints.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+
3
+ def get_ollam_response(prompt):
4
+ response = requests.post(
5
+ "http://localhost:11434/api/generate",
6
+ json={
7
+ "model": "wizardcoder",
8
+ "prompt": prompt,
9
+ "stream": False
10
+ }
11
+ )
12
+ resp = response.json()
13
+ return resp["response"], resp["eval_count"]