|
--- |
|
tags: |
|
- autotrain |
|
- summarization |
|
language: |
|
- unk |
|
widget: |
|
- text: "I love AutoTrain" |
|
datasets: |
|
- sudeepshouche/autotrain-data-sushi |
|
co2_eq_emissions: |
|
emissions: 4.535146076696761 |
|
--- |
|
|
|
# Model Trained Using AutoTrain |
|
|
|
- Problem type: Summarization |
|
- Model ID: 94046145981 |
|
- CO2 Emissions (in grams): 4.5351 |
|
|
|
## Validation Metrics |
|
|
|
- Loss: 1.876 |
|
- Rouge1: 45.886 |
|
- Rouge2: 18.852 |
|
- RougeL: 27.850 |
|
- RougeLsum: 40.554 |
|
- Gen Len: 104.307 |
|
|
|
## Usage |
|
|
|
You can use cURL to access this model: |
|
|
|
``` |
|
$ curl -X POST -H "Authorization: Bearer YOUR_HUGGINGFACE_API_KEY" -H "Content-Type: application/json" -d '{"inputs": "I love AutoTrain"}' https://api-inference.huggingface.co/sudeepshouche/autotrain-sushi-94046145981 |
|
``` |
|
|
|
Or try this python code: |
|
```python |
|
class TextSummarizer: |
|
def __init__(self): |
|
self.api_token = <HF_TOKEN> |
|
self.model = "sudeepshouche/autotrain-sushi-94046145981" |
|
|
|
def summarize(self, content): |
|
api_url = f"https://api-inference.huggingface.co/models/{self.model}" |
|
headers = {"Authorization": f"Bearer {self.api_token}"} |
|
payload = {"inputs": content} |
|
|
|
try: |
|
response = requests.post(api_url, headers=headers, json=payload) |
|
response.raise_for_status() |
|
return response.json() |
|
except requests.RequestException as e: |
|
print(f"Error during summarization: {e}") |
|
# logging.error(f"Error during summarization: {e}") |
|
return [{'summary_text': content}] |
|
|
|
content = <CONTENT_TO_SUMMARIZE> |
|
output = TextSummarizer().summarize(content) |
|
print (output[0]["summary_text"] ) |
|
``` |