Spaces:
Sleeping
Sleeping
Create app.py
Browse files
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 |
+
|