update download
Browse files
app.py
CHANGED
@@ -31,7 +31,7 @@ class PDBSearchAssistant:
|
|
31 |
max_new_tokens=1024,
|
32 |
temperature=0.1,
|
33 |
torch_dtype="auto",
|
34 |
-
device="
|
35 |
)
|
36 |
|
37 |
self.prompt_template = """
|
@@ -1229,12 +1229,20 @@ def server(input, output, session):
|
|
1229 |
@output
|
1230 |
@render.download(filename="pdb_search_results.csv")
|
1231 |
def download():
|
|
|
|
|
|
|
|
|
1232 |
current_results = results_store.get()
|
1233 |
if current_results["type"] == "structure":
|
1234 |
df = pd.DataFrame(current_results["results"])
|
1235 |
else:
|
|
|
1236 |
df = pd.DataFrame(current_results["results"])
|
1237 |
-
|
|
|
|
|
|
|
1238 |
|
1239 |
app = App(app_ui, server)
|
1240 |
|
|
|
31 |
max_new_tokens=1024,
|
32 |
temperature=0.1,
|
33 |
torch_dtype="auto",
|
34 |
+
device="cpu" # cuda or cpu
|
35 |
)
|
36 |
|
37 |
self.prompt_template = """
|
|
|
1229 |
@output
|
1230 |
@render.download(filename="pdb_search_results.csv")
|
1231 |
def download():
|
1232 |
+
file_path = "pdb_search_results.csv"
|
1233 |
+
if os.path.exists(file_path):
|
1234 |
+
os.remove(file_path)
|
1235 |
+
|
1236 |
current_results = results_store.get()
|
1237 |
if current_results["type"] == "structure":
|
1238 |
df = pd.DataFrame(current_results["results"])
|
1239 |
else:
|
1240 |
+
print()
|
1241 |
df = pd.DataFrame(current_results["results"])
|
1242 |
+
|
1243 |
+
df.to_csv(file_path, index=False)
|
1244 |
+
|
1245 |
+
return file_path
|
1246 |
|
1247 |
app = App(app_ui, server)
|
1248 |
|