davidmezzetti
commited on
Commit
•
16c92e7
1
Parent(s):
687c06e
Update app.py
Browse files
app.py
CHANGED
@@ -253,7 +253,9 @@ class Application:
|
|
253 |
if component in ["service", "translation"]:
|
254 |
# Service config is found in tasks section
|
255 |
tasks = list(workflow["workflow"].values())[0]["tasks"]
|
256 |
-
|
|
|
|
|
257 |
else:
|
258 |
config = workflow.get(component)
|
259 |
|
@@ -412,7 +414,11 @@ class Application:
|
|
412 |
text for matching uid
|
413 |
"""
|
414 |
|
415 |
-
|
|
|
|
|
|
|
|
|
416 |
|
417 |
def process(self, data, workflow):
|
418 |
"""
|
@@ -472,8 +478,8 @@ class Application:
|
|
472 |
)
|
473 |
|
474 |
if query:
|
475 |
-
df = pd.DataFrame([{"content": self.find(uid), "score": score} for uid, score in self.embeddings.search(query, limit)])
|
476 |
-
st.
|
477 |
|
478 |
def parse(self, data):
|
479 |
"""
|
|
|
253 |
if component in ["service", "translation"]:
|
254 |
# Service config is found in tasks section
|
255 |
tasks = list(workflow["workflow"].values())[0]["tasks"]
|
256 |
+
tasks = [task for task in tasks if task.get("task") == component or task.get("action") == component]
|
257 |
+
if tasks:
|
258 |
+
config = tasks[0]
|
259 |
else:
|
260 |
config = workflow.get(component)
|
261 |
|
|
|
414 |
text for matching uid
|
415 |
"""
|
416 |
|
417 |
+
text = [text for uid, text, _ in self.data if uid == key][0]
|
418 |
+
if key and key.lower().startswith("http"):
|
419 |
+
return "<a href='%s' rel='noopener noreferrer' target='blank'>%s</a>" % (key, text)
|
420 |
+
|
421 |
+
return text
|
422 |
|
423 |
def process(self, data, workflow):
|
424 |
"""
|
|
|
478 |
)
|
479 |
|
480 |
if query:
|
481 |
+
df = pd.DataFrame([{"content": self.find(uid), "score": "%.2f" % score} for uid, score in self.embeddings.search(query, limit)])
|
482 |
+
st.write(df.to_html(escape=False), unsafe_allow_html=True)
|
483 |
|
484 |
def parse(self, data):
|
485 |
"""
|