Spaces:
Runtime error
Runtime error
Etash Guha
commited on
Commit
•
7936375
1
Parent(s):
2c75021
changed key
Browse files- generators/model.py +12 -7
generators/model.py
CHANGED
@@ -125,6 +125,13 @@ class Samba():
|
|
125 |
resps = []
|
126 |
|
127 |
for i in range(num_comps):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
payload = {
|
129 |
"inputs": [dataclasses.asdict(message) for message in messages],
|
130 |
"params": {
|
@@ -135,13 +142,10 @@ class Samba():
|
|
135 |
},
|
136 |
"model": "llama3-8b"
|
137 |
}
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
"Content-Type": "application/json"
|
143 |
-
}
|
144 |
-
post_response = requests.post(f'https://{url}/api/v1/chat/completion', json=payload, headers=headers, stream=True)
|
145 |
response_text = ""
|
146 |
for line in post_response.iter_lines():
|
147 |
if line.startswith(b"data: "):
|
@@ -153,6 +157,7 @@ class Samba():
|
|
153 |
response_text += content
|
154 |
except json.JSONDecodeError as e:
|
155 |
pass
|
|
|
156 |
resps.append(response_text)
|
157 |
if num_comps == 1:
|
158 |
return resps[0]
|
|
|
125 |
resps = []
|
126 |
|
127 |
for i in range(num_comps):
|
128 |
+
url = "kjddazcq2e2wzvzv.snova.ai"
|
129 |
+
api_key = "bGlnaHRuaW5nOlUyM3pMcFlHY3dmVzRzUGFy"
|
130 |
+
url = f'https://{url}/api/v1/chat/completion'
|
131 |
+
headers = {
|
132 |
+
'Authorization': f'Basic {api_key}',
|
133 |
+
'Content-Type': 'application/json',
|
134 |
+
}
|
135 |
payload = {
|
136 |
"inputs": [dataclasses.asdict(message) for message in messages],
|
137 |
"params": {
|
|
|
142 |
},
|
143 |
"model": "llama3-8b"
|
144 |
}
|
145 |
+
|
146 |
+
|
147 |
+
|
148 |
+
post_response = requests.post(url, headers=headers, data=payload)
|
|
|
|
|
|
|
149 |
response_text = ""
|
150 |
for line in post_response.iter_lines():
|
151 |
if line.startswith(b"data: "):
|
|
|
157 |
response_text += content
|
158 |
except json.JSONDecodeError as e:
|
159 |
pass
|
160 |
+
breakpoint()
|
161 |
resps.append(response_text)
|
162 |
if num_comps == 1:
|
163 |
return resps[0]
|