Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,7 +7,7 @@ Original file is located at
|
|
| 7 |
https://colab.research.google.com/drive/1zk7xuWSf7ii7zowOqNVLy0FwXYVHYE2V
|
| 8 |
"""
|
| 9 |
|
| 10 |
-
#
|
| 11 |
import PyPDF2
|
| 12 |
import re
|
| 13 |
import transformers
|
|
@@ -15,7 +15,9 @@ from transformers import pipeline
|
|
| 15 |
from bark import SAMPLE_RATE, generate_audio, preload_models
|
| 16 |
from scipy.io.wavfile import write as write_wav
|
| 17 |
from IPython.display import Audio
|
|
|
|
| 18 |
|
|
|
|
| 19 |
def abstract_to_audio(insert_pdf):
|
| 20 |
# Extracting the abstract text from the article pdf
|
| 21 |
def extract_abstract(pdf_file):
|
|
@@ -72,8 +74,9 @@ def abstract_to_audio(insert_pdf):
|
|
| 72 |
# play text in notebook
|
| 73 |
return Audio(audio_array, rate=SAMPLE_RATE)
|
| 74 |
|
| 75 |
-
!pip install gradio
|
| 76 |
-
import gradio as gr
|
| 77 |
|
| 78 |
-
|
|
|
|
|
|
|
|
|
|
| 79 |
my_app.launch(share=True)
|
|
|
|
| 7 |
https://colab.research.google.com/drive/1zk7xuWSf7ii7zowOqNVLy0FwXYVHYE2V
|
| 8 |
"""
|
| 9 |
|
| 10 |
+
# Imports
|
| 11 |
import PyPDF2
|
| 12 |
import re
|
| 13 |
import transformers
|
|
|
|
| 15 |
from bark import SAMPLE_RATE, generate_audio, preload_models
|
| 16 |
from scipy.io.wavfile import write as write_wav
|
| 17 |
from IPython.display import Audio
|
| 18 |
+
import gradio as gr
|
| 19 |
|
| 20 |
+
# Code
|
| 21 |
def abstract_to_audio(insert_pdf):
|
| 22 |
# Extracting the abstract text from the article pdf
|
| 23 |
def extract_abstract(pdf_file):
|
|
|
|
| 74 |
# play text in notebook
|
| 75 |
return Audio(audio_array, rate=SAMPLE_RATE)
|
| 76 |
|
|
|
|
|
|
|
| 77 |
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
my_app = gr.Interface(fn=abstract_to_audio, inputs='file', outputs='audio', title="PDF Abstract Summarizer",
|
| 81 |
+
description="Extracts abstracts from PDFs and generates audio summaries.")
|
| 82 |
my_app.launch(share=True)
|