Spaces:
Sleeping
Sleeping
# prompt: write a streamlit app that enables users to input a ipynb file and summerizes what code inside the file does | |
import streamlit as st | |
from transformers import pipeline | |
from pathlib import Path | |
from llama_index import download_loader | |
summarizer = pipeline("summarization", model="facebook/bart-large-cnn") | |
def main(): | |
st.title("IPYNB Summarizer") | |
uploaded_file = st.file_uploader("Upload your IPYNB file", type="ipynb") | |
if uploaded_file is not None: | |
# Load the IPYNB file | |
loader = IPYNBReader(concatenate=True) | |
documents = loader.load_data(file=Path(uploaded_file)) | |
# Summarize the code in the IPYNB file | |
summaries = summarizer(documents) | |
# Display the summaries | |
for summary in summaries: | |
st.write(summary) | |