Spaces:
Runtime error
Runtime error
Download app.py from pk248/Dialogue-Summarizer: direct link, hf CLI and curl.
- Browser
- Download file 775 Bytes
-
https://huggingface.co/spaces/pk248/Dialogue-Summarizer/resolve/main/app.py
- Command line
-
hf download hf://spaces/pk248/Dialogue-Summarizer/app.py
-
curl -L -o app.py https://huggingface.co/spaces/pk248/Dialogue-Summarizer/resolve/main/app.py
775 Bytes
| import streamlit as st | |
| from transformers import pipeline | |
| # Function to load the model | |
| def load_model(): | |
| summarizer = pipeline("text2text-generation", model="pk248/pegasus-samsum") | |
| return summarizer | |
| # Load the model | |
| model = load_model() | |
| # Streamlit UI | |
| st.title("Dialogue Summarization App") | |
| st.write("This app uses the pk248/pegasus-samsum model to summarize coversations.") | |
| # Text input | |
| user_input = st.text_area("Enter text to summarize:", height=200) | |
| # Summarize button | |
| if st.button("Summarize"): | |
| if user_input: | |
| # Model inference | |
| summary = model(user_input, max_length=1000, min_length=5, length_penalty=2.0) | |
| st.write(summary[0]["generated_text"]) | |
| else: | |
| st.write("Please enter some text to summarize.") | |