Spaces:
Sleeping
Sleeping
File size: 758 Bytes
e5604e1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# 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)
|