File size: 1,610 Bytes
0d74ced
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5cd8b35
 
 
24646b8
5cd8b35
 
 
6c23536
5cd8b35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0d74ced
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
---
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"] )
```