Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -6,12 +6,21 @@ For more information on `huggingface_hub` Inference API support, please check th
|
|
6 |
"""
|
7 |
#client = InferenceClient("esha111/recipe-generator")
|
8 |
|
9 |
-
from llama_cpp import Llama
|
10 |
|
11 |
-
llm = Llama.from_pretrained(
|
12 |
-
repo_id="esha111/recipe-generator",
|
13 |
-
filename="model-q8_0.gguf",
|
14 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
def respond(
|
17 |
message,
|
@@ -46,11 +55,15 @@ def respond(
|
|
46 |
response += token
|
47 |
yield response
|
48 |
"""
|
49 |
-
output = llm(
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
)
|
|
|
|
|
|
|
|
|
54 |
return output
|
55 |
|
56 |
"""
|
|
|
6 |
"""
|
7 |
#client = InferenceClient("esha111/recipe-generator")
|
8 |
|
9 |
+
#from llama_cpp import Llama
|
10 |
|
11 |
+
#llm = Llama.from_pretrained(
|
12 |
+
# repo_id="esha111/recipe-generator",
|
13 |
+
# filename="model-q8_0.gguf",
|
14 |
+
#)
|
15 |
+
|
16 |
+
import requests
|
17 |
+
|
18 |
+
API_URL = "https://api-inference.huggingface.co/models/esha111/recipe-generator"
|
19 |
+
|
20 |
+
def query(payload):
|
21 |
+
response = requests.post(API_URL, json=payload)
|
22 |
+
return response.json()
|
23 |
+
|
24 |
|
25 |
def respond(
|
26 |
message,
|
|
|
55 |
response += token
|
56 |
yield response
|
57 |
"""
|
58 |
+
#output = llm(
|
59 |
+
# message,
|
60 |
+
# max_tokens=512,
|
61 |
+
# echo=True
|
62 |
+
#)
|
63 |
+
|
64 |
+
output = query({
|
65 |
+
"inputs": message,
|
66 |
+
})
|
67 |
return output
|
68 |
|
69 |
"""
|