yannESGI commited on
Commit
936a4f0
·
1 Parent(s): a4a0aee

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -0
app.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import fitz
3
+ from transformers import pipeline
4
+ import os
5
+ import requests
6
+ import io
7
+ from PIL import Image
8
+
9
+ API_URL = "https://api-inference.huggingface.co/models/runwayml/stable-diffusion-v1-5"
10
+ headers = {"Authorization": "Bearer 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"}
11
+ summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
12
+
13
+ #def extract_paragraph(texte):
14
+ # paragraph = texte.split("\n\n")
15
+ # return paragraph
16
+
17
+ st.title("PDF2SLIDE")
18
+
19
+ uploaded_file = st.file_uploader("Selectionnez un PDF", type=["pdf"])
20
+
21
+ if uploaded_file is not None:
22
+ pdf_document = fitz.open(stream=uploaded_file.read(), filetype="pdf")
23
+
24
+ paragraphs = []
25
+
26
+ for page_number in range(pdf_document.page_count):
27
+ page = pdf_document.load_page(page_number)
28
+ page_text = page.get_text()
29
+ #print(page_text)
30
+ paragraphs = page_text.split("\n")
31
+ for paragraph in paragraphs:
32
+ print(paragraph)
33
+ print(424242)
34
+