Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -8,11 +8,11 @@ API_URL = "https://api-inference.huggingface.co/models/foxxy-hm/mt5-small-finetu
|
|
8 |
headers = {"Authorization": f"Bearer {SECRET_TOKEN}"}
|
9 |
|
10 |
def query(payload):
|
11 |
-
try:
|
12 |
-
|
13 |
-
|
14 |
-
except Exception as e: # catch any kind of error
|
15 |
-
|
16 |
|
17 |
|
18 |
examples = [
|
|
|
8 |
headers = {"Authorization": f"Bearer {SECRET_TOKEN}"}
|
9 |
|
10 |
def query(payload):
|
11 |
+
# try:
|
12 |
+
response = requests.post(API_URL, headers=headers, json=payload)
|
13 |
+
return response.json()[0]["generated_text"]
|
14 |
+
# except Exception as e: # catch any kind of error
|
15 |
+
# return f"Error: {e}" # return the error message
|
16 |
|
17 |
|
18 |
examples = [
|