manika07 commited on
Commit
cb480a0
·
1 Parent(s): fadb089

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -32
app.py CHANGED
@@ -29,6 +29,29 @@ def get_ext(uploaded_file):
29
  extype = uID+uploaded_file.name
30
  return extype
31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  def read_tf(url):
33
  response = requests.get(url)
34
  open("temp.pkl", "wb").write(response.content)
@@ -61,38 +84,6 @@ def conv_txt(extype):
61
  return papers
62
 
63
 
64
- #===Read data===
65
-
66
- # uploaded_file = st.file_uploader("Choose a file", type=['csv'])
67
-
68
- # df = None # Initialize df as None outside the if block
69
-
70
- # if uploaded_file is not None:
71
- # df = pd.read_csv(uploaded_file, encoding='latin-1')
72
- # st.dataframe(df)
73
-
74
- # # Tag the "Abstract" column with the corresponding categories
75
- # df['category'] = df['Abstract'].apply(predict_category)
76
- # # df['category'] = df['category'].str[2:-2]
77
-
78
- # st.dataframe(df)
79
-
80
- # st.sidebar.header("Download Results")
81
- # st.sidebar.text("Download the tagged results as a CSV file.")
82
-
83
- # if df is not None:
84
- # csv = df.to_csv(index=False)
85
- # b64 = base64.b64encode(csv.encode()).decode()
86
- # st.sidebar.download_button(
87
- # label="Download",
88
- # data=b64,
89
- # file_name="results.csv",
90
- # mime="text/csv"
91
- # )
92
- # else:
93
- # st.sidebar.text("Please upload a file first to enable the download button.")
94
-
95
-
96
  uploaded_file = st.file_uploader("Choose a file", type=['csv'])
97
  st.sidebar.header("Download Results")
98
  st.sidebar.text("Download the tagged results as a CSV file.")
 
29
  extype = uID+uploaded_file.name
30
  return extype
31
 
32
+
33
+
34
+ @st.cache_resource(ttl=3600)
35
+ # def read_model(local_path):
36
+ # with open(local_path, "rb") as f:
37
+ # svm_classifier = pickle.load(f)
38
+ # return svm_classifier
39
+
40
+
41
+ # def read_tf(local_path):
42
+ # with open(local_path, "rb") as f:
43
+ # preprocessing = pickle.load(f)
44
+ # return preprocessing
45
+
46
+
47
+ def read_model(url):
48
+ response = requests.get(url)
49
+ open("temp.pkl", "wb").write(response.content)
50
+ with open("temp.pkl", "rb") as f:
51
+ svm_classifier = pickle.load(f)
52
+ return svm_classifier
53
+
54
+
55
  def read_tf(url):
56
  response = requests.get(url)
57
  open("temp.pkl", "wb").write(response.content)
 
84
  return papers
85
 
86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  uploaded_file = st.file_uploader("Choose a file", type=['csv'])
88
  st.sidebar.header("Download Results")
89
  st.sidebar.text("Download the tagged results as a CSV file.")