Spaces:
Sleeping
Sleeping
import os | |
import io | |
from dotenv import load_dotenv, find_dotenv | |
import requests, json | |
from transformers import pipeline | |
import gradio as gr | |
from transformers import pipeline | |
# Access the Hugging Face API key and endpoint URL | |
hf_api_key = os.getenv('HF_API_KEY') | |
ENDPOINT_URL = os.getenv('HF_API_SUMMARY_BASE') | |
#Summarization endpoint | |
get_completion = pipeline("summarization", model="shleifer/distilbart-cnn-12-6") | |
def summarize(input): | |
output = get_completion(input) | |
return output[0]['summary_text'] | |
demo = gr.Interface(fn=summarize, inputs="text", outputs="text") | |
demo.launch() |