Update app.py
Browse files
app.py
CHANGED
@@ -5,9 +5,24 @@ import io
|
|
5 |
|
6 |
def predict_and_download(positive_csv_file, unlabelled_csv_file, n, text):
|
7 |
selected_paper_info = oneclass.select_top_n_papers(n, positive_csv_file, unlabelled_csv_file)
|
8 |
-
|
9 |
-
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
# Create the interface
|
13 |
iface = gr.Interface(
|
|
|
5 |
|
6 |
def predict_and_download(positive_csv_file, unlabelled_csv_file, n, text):
|
7 |
selected_paper_info = oneclass.select_top_n_papers(n, positive_csv_file, unlabelled_csv_file)
|
8 |
+
|
9 |
+
# Create a StringIO object to store CSV data
|
10 |
+
csv_buffer = StringIO()
|
11 |
+
|
12 |
+
# Write DataFrame to the StringIO buffer as CSV
|
13 |
+
selected_paper_info.to_csv(csv_buffer, index=False)
|
14 |
+
|
15 |
+
# Get the CSV data from the buffer
|
16 |
+
csv_content = csv_buffer.getvalue()
|
17 |
+
|
18 |
+
# Close the buffer
|
19 |
+
csv_buffer.close()
|
20 |
+
|
21 |
+
# Save CSV content to a variable
|
22 |
+
csv_variable = csv_content
|
23 |
+
|
24 |
+
# Return selected_paper_info and CSV content
|
25 |
+
return selected_paper_info, csv_variable
|
26 |
|
27 |
# Create the interface
|
28 |
iface = gr.Interface(
|