Aytaj commited on
Commit
e5604e1
·
1 Parent(s): ec36373

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # prompt: write a streamlit app that enables users to input a ipynb file and summerizes what code inside the file does
2
+
3
+ import streamlit as st
4
+ from transformers import pipeline
5
+ from pathlib import Path
6
+ from llama_index import download_loader
7
+
8
+ summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
9
+
10
+ def main():
11
+ st.title("IPYNB Summarizer")
12
+ uploaded_file = st.file_uploader("Upload your IPYNB file", type="ipynb")
13
+ if uploaded_file is not None:
14
+ # Load the IPYNB file
15
+ loader = IPYNBReader(concatenate=True)
16
+ documents = loader.load_data(file=Path(uploaded_file))
17
+ # Summarize the code in the IPYNB file
18
+ summaries = summarizer(documents)
19
+ # Display the summaries
20
+ for summary in summaries:
21
+ st.write(summary)
22
+