Skip to content

Commit

Permalink
updated interaction streaming
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan-Adly committed Nov 22, 2023
1 parent bd1aa49 commit f2cfb87
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
8 changes: 4 additions & 4 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
app = Flask(__name__)

# BASE_URL = "https://galenai.co" # use this for production
BASE_URL = (
"" # request access to a sandbox environment by emailing [email protected]
)

# request access to a sandbox environment by emailing [email protected]
BASE_URL = ""

TOKEN = "" # request a free test token by emailing [email protected]
# request a free test token by emailing [email protected]
TOKEN = ""


@app.route("/", methods=["GET", "POST"])
Expand Down
26 changes: 19 additions & 7 deletions templates/listening_interactions.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,11 @@ <h1>Channel Name: {{channel_name}}</h1>
channel.bind("new_interaction", function (data) {
let id = data.id;
// make a new div for each new interaction that has drug pair, description, recommendation, references
document.getElementById("answer").innerHTML += `<div id=${id}-drug-pair> "</div>`;

document.getElementById("answer").innerHTML += `<div id=${id}-description> "</div>`;
document.getElementById("answer").innerHTML += `<div id=${id}-drug-pair> "</div>`;
document.getElementById("answer").innerHTML += `<div id=${id}-severity> "</div>`;
document.getElementById("answer").innerHTML += `<div id=${id}-recommendation> "</div>`;
document.getElementById("answer").innerHTML += `<div id=${id}-management> "</div>`;
document.getElementById("answer").innerHTML += `<div id=${id}-description> "</div>`;
document.getElementById("answer").innerHTML += `<div id=${id}-references> "</div>`;

});
Expand All @@ -61,16 +62,27 @@ <h1>Channel Name: {{channel_name}}</h1>
document.getElementById(`${data.id}-drug-pair`).innerHTML += data.text;
});

channel.bind("severity", function (data) {
// add the severity to the div
document.getElementById(`${data.id}-severity`).innerHTML += data.text;
});

channel.bind("recommendation", function (data) {
// add the recommendation to the div
document.getElementById(`${data.id}-recommendation`).innerHTML += data.text;
});

channel.bind("management", function (data) {
// add the management to the div
document.getElementById(`${data.id}-management`).innerHTML += data.text;
});

channel.bind("description", function (data) {
// add the description to the div
document.getElementById(`${data.id}-description`).innerHTML += data.text;
});

channel.bind("recommendation", function (data) {
// add the recommendation to the div
document.getElementById(`${data.id}-recommendation`).innerHTML += data.text;
});


channel.bind("references", function (data) {
// make a div for title, doi, url, abstract inside references
Expand Down

0 comments on commit f2cfb87

Please sign in to comment.