Update app.py
Browse files
app.py
CHANGED
@@ -4,8 +4,6 @@ from transformers import pipeline
|
|
4 |
|
5 |
# Load translation and summarization pipelines
|
6 |
translator = pipeline("translation_ru_to_en", model="Helsinki-NLP/opus-mt-ru-en")
|
7 |
-
summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
|
8 |
-
|
9 |
# Function to translate and summarize text
|
10 |
def translate_and_summarize(text):
|
11 |
translated_text = translator(text)[0]['translation_text']
|
@@ -13,12 +11,6 @@ def translate_and_summarize(text):
|
|
13 |
return summary
|
14 |
|
15 |
# Streamlit interface
|
16 |
-
def main():
|
17 |
-
st.title("CSV Translator and Summarizer")
|
18 |
-
|
19 |
-
# File uploader
|
20 |
-
uploaded_file = st.file_uploader("Choose a CSV file", type="csv")
|
21 |
-
if uploaded_file is not None:
|
22 |
# Read data
|
23 |
data = pd.read_csv(uploaded_file)
|
24 |
|
@@ -30,7 +22,7 @@ def main():
|
|
30 |
return
|
31 |
|
32 |
# Filter rows where 'Published' is unchecked (assuming False or equivalent)
|
33 |
-
data_filtered = data[
|
34 |
|
35 |
# Apply translation and summarization
|
36 |
if not data_filtered.empty:
|
@@ -41,4 +33,4 @@ def main():
|
|
41 |
st.write("No unpublished descriptions to process.")
|
42 |
|
43 |
if __name__ == "__main__":
|
44 |
-
main()
|
|
|
4 |
|
5 |
# Load translation and summarization pipelines
|
6 |
translator = pipeline("translation_ru_to_en", model="Helsinki-NLP/opus-mt-ru-en")
|
|
|
|
|
7 |
# Function to translate and summarize text
|
8 |
def translate_and_summarize(text):
|
9 |
translated_text = translator(text)[0]['translation_text']
|
|
|
11 |
return summary
|
12 |
|
13 |
# Streamlit interface
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
# Read data
|
15 |
data = pd.read_csv(uploaded_file)
|
16 |
|
|
|
22 |
return
|
23 |
|
24 |
# Filter rows where 'Published' is unchecked (assuming False or equivalent)
|
25 |
+
data_filtered = data['Published']
|
26 |
|
27 |
# Apply translation and summarization
|
28 |
if not data_filtered.empty:
|
|
|
33 |
st.write("No unpublished descriptions to process.")
|
34 |
|
35 |
if __name__ == "__main__":
|
36 |
+
main()
|