AyushDey commited on
Commit
6f3970d
1 Parent(s): 5b38fc2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -22
app.py CHANGED
@@ -1,22 +0,0 @@
1
- import json
2
- import os
3
- import requests
4
- import gradio as gr
5
- hf_key = os.environ.get('HF_API_KEY')
6
- headers = headers = {
7
- "Authorization": f"Bearer {hf_key}",
8
- "Content-Type": "application/json"
9
- }
10
- API_URL = "https://api-inference.huggingface.co/models/facebook/bart-large-cnn"
11
- def query(payload):
12
- data = {'inputs': payload}
13
- response = requests.request("POST", API_URL, headers=headers, data=json.dumps(data))
14
- return json.loads(response.content.decode("utf-8"))
15
- def summarization(input):
16
- output = query(input)
17
- return output[0]['summary_text']
18
-
19
- gr.close_all()
20
-
21
- demo = gr.Interface(fn=summarization, inputs='text', outputs='text')
22
- demo.launch()