Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -8,13 +8,9 @@ API_TOKEN = os.getenv("AUTH_TOKEN")
|
|
8 |
HEADERS = {"Authorization": f"Bearer {API_TOKEN}"}
|
9 |
|
10 |
def predict(message, history):
|
11 |
-
# Prepare input data for the Hugging Face API
|
12 |
-
history_transformer_format = history + [[message, ""]]
|
13 |
-
messages = "".join([f"<human>:{item[0]}\n<bot>:{item[1]}" for item in history_transformer_format])
|
14 |
-
|
15 |
try:
|
16 |
-
# Send request to the Hugging Face API
|
17 |
-
payload = {"inputs":
|
18 |
response = requests.post(API_URL, headers=HEADERS, json=payload)
|
19 |
response.raise_for_status() # Raise exception for non-2xx status codes
|
20 |
|
|
|
8 |
HEADERS = {"Authorization": f"Bearer {API_TOKEN}"}
|
9 |
|
10 |
def predict(message, history):
|
|
|
|
|
|
|
|
|
11 |
try:
|
12 |
+
# Send request to the Hugging Face API with only the current message
|
13 |
+
payload = {"inputs": message}
|
14 |
response = requests.post(API_URL, headers=HEADERS, json=payload)
|
15 |
response.raise_for_status() # Raise exception for non-2xx status codes
|
16 |
|