ahmadmac commited on
Commit
212eb9f
1 Parent(s): a567818

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -2
app.py CHANGED
@@ -1,11 +1,21 @@
1
  import streamlit as st
2
  from transformers import pipeline
3
 
4
- @st.cache(allow_output_mutation=True)
 
 
 
 
 
 
 
 
 
 
5
  def load_summarizer():
6
  return pipeline("summarization", model="Falconsai/text_summarization")
7
 
8
- @st.cache(allow_output_mutation=True)
9
  def load_translator():
10
  return pipeline("translation", model="Helsinki-NLP/opus-mt-en-ur")
11
 
@@ -48,3 +58,4 @@ def main():
48
 
49
  if __name__ == "__main__":
50
  main()
 
 
1
  import streamlit as st
2
  from transformers import pipeline
3
 
4
+ # Install sentencepiece
5
+ import subprocess
6
+ import sys
7
+
8
+ def install(package):
9
+ subprocess.check_call([sys.executable, "-m", "pip", "install", package])
10
+
11
+ install("sentencepiece")
12
+
13
+ # Function to initialize pipelines with caching
14
+ @st.cache_resource
15
  def load_summarizer():
16
  return pipeline("summarization", model="Falconsai/text_summarization")
17
 
18
+ @st.cache_resource
19
  def load_translator():
20
  return pipeline("translation", model="Helsinki-NLP/opus-mt-en-ur")
21
 
 
58
 
59
  if __name__ == "__main__":
60
  main()
61
+