davidmezzetti
commited on
Commit
•
f21aa07
1
Parent(s):
56874e4
Update app.py
Browse files
app.py
CHANGED
@@ -6,6 +6,7 @@ Based on this example: https://github.com/neuml/txtai/blob/master/examples/workf
|
|
6 |
|
7 |
import os
|
8 |
import re
|
|
|
9 |
|
10 |
import nltk
|
11 |
import yaml
|
@@ -45,6 +46,9 @@ class Application:
|
|
45 |
self.documents = None
|
46 |
self.data = None
|
47 |
|
|
|
|
|
|
|
48 |
def load(self, components):
|
49 |
"""
|
50 |
Load an existing workflow file.
|
@@ -451,7 +455,13 @@ class Application:
|
|
451 |
# Clear workflow
|
452 |
self.documents, self.pipelines, self.workflow = None, None, None
|
453 |
|
454 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
455 |
default = self.appsetting(workflow, "query")
|
456 |
default = default if default else ""
|
457 |
|
|
|
6 |
|
7 |
import os
|
8 |
import re
|
9 |
+
import uuid
|
10 |
|
11 |
import nltk
|
12 |
import yaml
|
|
|
46 |
self.documents = None
|
47 |
self.data = None
|
48 |
|
49 |
+
# Workflow run id
|
50 |
+
self.runid = None
|
51 |
+
|
52 |
def load(self, components):
|
53 |
"""
|
54 |
Load an existing workflow file.
|
|
|
455 |
# Clear workflow
|
456 |
self.documents, self.pipelines, self.workflow = None, None, None
|
457 |
|
458 |
+
# Generate workflow run id
|
459 |
+
self.runid = str(uuid.uuid1())
|
460 |
+
st.session_state["runid"] = self.runid
|
461 |
+
|
462 |
+
if self.runid != self.state("runid"):
|
463 |
+
st.error("Workflow data changed in another session. Please re-build and re-run workflow.")
|
464 |
+
elif self.embeddings and self.data:
|
465 |
default = self.appsetting(workflow, "query")
|
466 |
default = default if default else ""
|
467 |
|