Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -39,7 +39,9 @@ TOKEN = os.environ.get("TOKEN")
|
|
| 39 |
HEADERS = {
|
| 40 |
"Authorization": f"Bearer {TOKEN}",
|
| 41 |
"Content-Type": "application/json",
|
|
|
|
| 42 |
}
|
|
|
|
| 43 |
|
| 44 |
PRESENCE_PENALTY=0
|
| 45 |
FREQUENCY_PENALTY=1.1
|
|
@@ -156,9 +158,9 @@ with gr.Blocks() as demo:
|
|
| 156 |
keep_streaming = True
|
| 157 |
s = requests.Session()
|
| 158 |
with s.post(API_URL, headers=HEADERS, json=data, stream=True) as r:
|
|
|
|
| 159 |
for line in r.iter_lines():
|
| 160 |
if line and keep_streaming:
|
| 161 |
-
print(r.status_code)
|
| 162 |
assert r.status_code == 200
|
| 163 |
json_response = json.loads(line)
|
| 164 |
|
|
|
|
| 39 |
HEADERS = {
|
| 40 |
"Authorization": f"Bearer {TOKEN}",
|
| 41 |
"Content-Type": "application/json",
|
| 42 |
+
"accept": "application/json"
|
| 43 |
}
|
| 44 |
+
print(HEADERS)
|
| 45 |
|
| 46 |
PRESENCE_PENALTY=0
|
| 47 |
FREQUENCY_PENALTY=1.1
|
|
|
|
| 158 |
keep_streaming = True
|
| 159 |
s = requests.Session()
|
| 160 |
with s.post(API_URL, headers=HEADERS, json=data, stream=True) as r:
|
| 161 |
+
print(r)
|
| 162 |
for line in r.iter_lines():
|
| 163 |
if line and keep_streaming:
|
|
|
|
| 164 |
assert r.status_code == 200
|
| 165 |
json_response = json.loads(line)
|
| 166 |
|