Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -5,12 +5,8 @@ import pandas as pd
|
|
5 |
from transformers import pipeline
|
6 |
import json
|
7 |
|
8 |
-
import
|
9 |
|
10 |
-
# Create a new directory
|
11 |
-
directory_name = "documents"
|
12 |
-
if not os.path.exists(directory_name):
|
13 |
-
os.makedirs(directory_name)
|
14 |
|
15 |
|
16 |
|
@@ -70,19 +66,22 @@ def main():
|
|
70 |
|
71 |
|
72 |
st.image('banner_image.jpg')
|
73 |
-
|
|
|
|
|
|
|
74 |
|
75 |
|
76 |
elif choice=="Summarizer":
|
77 |
st.subheader("Text Summarization")
|
78 |
st.write(" Enter the Text you want to summarize !")
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
raw_text = documents[
|
86 |
num_words = st.number_input("Enter Number of Words in Summary")
|
87 |
|
88 |
if raw_text!="" and num_words is not None:
|
|
|
5 |
from transformers import pipeline
|
6 |
import json
|
7 |
|
8 |
+
from datasets import load_dataset
|
9 |
|
|
|
|
|
|
|
|
|
10 |
|
11 |
|
12 |
|
|
|
66 |
|
67 |
|
68 |
st.image('banner_image.jpg')
|
69 |
+
|
70 |
+
|
71 |
+
|
72 |
+
|
73 |
|
74 |
|
75 |
elif choice=="Summarizer":
|
76 |
st.subheader("Text Summarization")
|
77 |
st.write(" Enter the Text you want to summarize !")
|
78 |
+
# Create a dropdown to select which document to read
|
79 |
+
document_names = [str(document['id']) for document in dataset['documents']]
|
80 |
+
document_to_read = st.selectbox("Select a document to read", document_names)
|
81 |
+
# Read the selected document
|
82 |
+
selected_document = dataset['documents'][int(document_to_read)]
|
83 |
+
document_text = selected_document['text']
|
84 |
+
raw_text = documents[document_text]
|
85 |
num_words = st.number_input("Enter Number of Words in Summary")
|
86 |
|
87 |
if raw_text!="" and num_words is not None:
|