Spaces:
Runtime error
Runtime error
Update app.py
Browse filesadded about section
app.py
CHANGED
|
@@ -1,15 +1,19 @@
|
|
| 1 |
|
| 2 |
-
#author:prathap
|
| 3 |
-
|
| 4 |
from transformers import pipeline
|
|
|
|
|
|
|
| 5 |
from bs4 import BeautifulSoup
|
| 6 |
-
import torch
|
| 7 |
import requests
|
| 8 |
-
import pandas as pd
|
| 9 |
import streamlit as st
|
| 10 |
import warnings
|
| 11 |
warnings.filterwarnings("ignore")
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
@st.cache(allow_output_mutation=True)
|
| 15 |
def pipen():
|
|
@@ -17,10 +21,17 @@ def pipen():
|
|
| 17 |
return summarizer
|
| 18 |
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
|
|
|
|
| 22 |
|
| 23 |
-
url = st.text_input('The URL link')
|
| 24 |
|
| 25 |
if st.button("Submit"):
|
| 26 |
r = requests.get(url)
|
|
@@ -33,6 +44,7 @@ if st.button("Submit"):
|
|
| 33 |
ARTICLE = ARTICLE.replace('?', '?<eos>')
|
| 34 |
ARTICLE = ARTICLE.replace('!', '!<eos>')
|
| 35 |
|
|
|
|
| 36 |
|
| 37 |
|
| 38 |
sentences = ARTICLE.split('<eos>')
|
|
@@ -56,9 +68,21 @@ if st.button("Submit"):
|
|
| 56 |
model=pipen()
|
| 57 |
res = model(chunks, max_length=120, min_length=30, do_sample=False)
|
| 58 |
text = ' '.join([summ['summary_text'] for summ in res])
|
| 59 |
-
print(len(text))
|
| 60 |
|
| 61 |
st.write("Success")
|
| 62 |
st.write(text)
|
| 63 |
-
|
| 64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
|
|
|
|
|
|
|
| 2 |
from transformers import pipeline
|
| 3 |
+
import base64
|
| 4 |
+
import time
|
| 5 |
from bs4 import BeautifulSoup
|
|
|
|
| 6 |
import requests
|
|
|
|
| 7 |
import streamlit as st
|
| 8 |
import warnings
|
| 9 |
warnings.filterwarnings("ignore")
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
timestr = time.strftime("%Y%m%d-%H%M%S")
|
| 13 |
+
|
| 14 |
+
st.markdown(' Created by **_Prathap_**. :baby_chick:')
|
| 15 |
+
|
| 16 |
+
st.title("Automatic text summarization")
|
| 17 |
|
| 18 |
@st.cache(allow_output_mutation=True)
|
| 19 |
def pipen():
|
|
|
|
| 21 |
return summarizer
|
| 22 |
|
| 23 |
|
| 24 |
+
def text_downloader(raw_text):
|
| 25 |
+
b64 = base64.b64encode(raw_text.encode()).decode()
|
| 26 |
+
new_filename = "new_text_file_{}_.txt".format(timestr)
|
| 27 |
+
st.markdown("#### Download File ###")
|
| 28 |
+
href = f'<a href="data:file/txt;base64,{b64}" download="{new_filename}">Click Here!!</a>'
|
| 29 |
+
st.markdown(href,unsafe_allow_html=True)
|
| 30 |
+
|
| 31 |
|
| 32 |
|
| 33 |
+
url = st.text_input('Paste URL ⤵️')
|
| 34 |
|
|
|
|
| 35 |
|
| 36 |
if st.button("Submit"):
|
| 37 |
r = requests.get(url)
|
|
|
|
| 44 |
ARTICLE = ARTICLE.replace('?', '?<eos>')
|
| 45 |
ARTICLE = ARTICLE.replace('!', '!<eos>')
|
| 46 |
|
| 47 |
+
|
| 48 |
|
| 49 |
|
| 50 |
sentences = ARTICLE.split('<eos>')
|
|
|
|
| 68 |
model=pipen()
|
| 69 |
res = model(chunks, max_length=120, min_length=30, do_sample=False)
|
| 70 |
text = ' '.join([summ['summary_text'] for summ in res])
|
|
|
|
| 71 |
|
| 72 |
st.write("Success")
|
| 73 |
st.write(text)
|
| 74 |
+
text_downloader(text)
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
if st.button("Contact"):
|
| 78 |
+
st.write("Hi there, I'm Prathap 👋. 2+ years Applied Deep Learning experience")
|
| 79 |
+
st.write("✅ [LinkedIn](www.linkedin.com/in/prathapreddyk)")
|
| 80 |
+
st.write(" 📚[Github](https://github.com/Pratap517)")
|
| 81 |
+
st.write(" 📗Analyze Csv files in one step [Click Here](https://share.streamlit.io/pratap517/streamlitapp_dataanalysis/main/main_app.py)")
|
| 82 |
+
st.write(" 😷 Face Mask Detection App [Click Here](https://mask-detection-5a800.firebaseapp.com/)")
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
|