Spaces:
Sleeping
Sleeping
Commit
·
663ae5c
1
Parent(s):
df04b4a
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,10 +17,12 @@ from langchain.chat_models import AzureChatOpenAI
|
|
| 17 |
from langchain.requests import TextRequestsWrapper
|
| 18 |
from langchain.tools.json.tool import JsonSpec
|
| 19 |
|
| 20 |
-
|
| 21 |
-
openai.
|
| 22 |
-
openai.
|
|
|
|
| 23 |
os.environ["OPENAI_API_VERSION"] = openai.api_version = "2023-03-15-preview"
|
|
|
|
| 24 |
st.set_page_config(layout="wide")
|
| 25 |
|
| 26 |
def analyze_healthcare_text(text):
|
|
@@ -109,7 +111,8 @@ def annotate_text_with_entities(original_text, entities_data):
|
|
| 109 |
# Get the color for the entity category
|
| 110 |
color = category_to_color[entity["category"]] + OPACITIES[entity["offset"] % len(OPACITIES)]
|
| 111 |
|
| 112 |
-
entity_html = f'<span id="entity-{entity_id}"><span style="display: inline-flex; flex-direction: row; align-items: center; background: {color}; border-radius: 0.5rem; padding: 0.25rem 0.5rem; overflow: hidden; line-height: 1;">{
|
|
|
|
| 113 |
|
| 114 |
# If there are links, create a dropdown menu with the links
|
| 115 |
if entity.get("links"):
|
|
|
|
| 17 |
from langchain.requests import TextRequestsWrapper
|
| 18 |
from langchain.tools.json.tool import JsonSpec
|
| 19 |
|
| 20 |
+
|
| 21 |
+
os.environ["OPENAI_API_BASE"] = openai.api_type = "azure"
|
| 22 |
+
os.environ["OPENAI_API_KEY"] = openai.api_key = "26d0aaa9d01340cca61da08b29c44069"
|
| 23 |
+
os.environ["OPENAI_API_BASE"] = openai.api_base = "https://eastus-openai-sean.openai.azure.com/"
|
| 24 |
os.environ["OPENAI_API_VERSION"] = openai.api_version = "2023-03-15-preview"
|
| 25 |
+
|
| 26 |
st.set_page_config(layout="wide")
|
| 27 |
|
| 28 |
def analyze_healthcare_text(text):
|
|
|
|
| 111 |
# Get the color for the entity category
|
| 112 |
color = category_to_color[entity["category"]] + OPACITIES[entity["offset"] % len(OPACITIES)]
|
| 113 |
|
| 114 |
+
entity_html = f'<span id="entity-{entity_id}"><span style="display: inline-flex; flex-direction: row; align-items: center; background: {color}; border-radius: 0.5rem; padding: 0.25rem 0.5rem; overflow: hidden; line-height: 1;">{escape(entity["text"])}'
|
| 115 |
+
|
| 116 |
|
| 117 |
# If there are links, create a dropdown menu with the links
|
| 118 |
if entity.get("links"):
|