options added
Browse files
app.py
CHANGED
@@ -9,7 +9,16 @@ SECRET_KEY = os.environ.get("summarizer")
|
|
9 |
|
10 |
async def summarize(text):
|
11 |
headers = {"Authorization": f"Bearer {SECRET_KEY}"}
|
12 |
-
data = {"inputs": text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
async with aiohttp.ClientSession() as session:
|
14 |
async with session.post(API_URL, headers=headers, json=data) as response:
|
15 |
response.raise_for_status() # Raise exception for non-200 status codes
|
|
|
9 |
|
10 |
async def summarize(text):
|
11 |
headers = {"Authorization": f"Bearer {SECRET_KEY}"}
|
12 |
+
data = {"inputs": text,
|
13 |
+
"options": {
|
14 |
+
"max_new_tokens": 50,
|
15 |
+
"min_length": 20,
|
16 |
+
"max_length": 500,
|
17 |
+
"length_penalty": 2.0,
|
18 |
+
"num_beams": 3,
|
19 |
+
"early_stopping": True
|
20 |
+
}
|
21 |
+
}
|
22 |
async with aiohttp.ClientSession() as session:
|
23 |
async with session.post(API_URL, headers=headers, json=data) as response:
|
24 |
response.raise_for_status() # Raise exception for non-200 status codes
|