Skip to content

Commit 3ed09f9

Browse files
authored
Merge pull request #55 from ks6088ts-labs/feature/issue-54_add-map-example
visualize location demo
2 parents 20db96b + 705d7c0 commit 3ed09f9

File tree

7 files changed

+61
-3
lines changed

7 files changed

+61
-3
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ repos:
1313
rev: 24.2.0
1414
hooks:
1515
- id: black
16-
exclude: 'generated/.*|artifacts/.*|.jsonl'
16+
exclude: 'generated/.*|artifacts/.*|.jsonl|.csv'

apps/6_call_azure_ai_search/1_create_index.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
def load_texts() -> list:
1111
# for simplicity, hardcoding the path to the text file
12-
with open("./apps/6_call_azure_ai_search/data/contoso_rules.txt") as f:
12+
with open("./datasets/contoso_rules.csv") as f:
1313
return f.readlines()
1414

1515

apps/99_streamlit_examples/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ Access to http://localhost:8501 and select the sample you want to run from the s
6161

6262
![Create image](../../docs/images/99_streamlit_examples.createimage.png)
6363

64+
#### 8. Visualize location
65+
66+
![Visualize location](../../docs/images/99_streamlit_examples.map.png)
67+
6468
## References
6569

6670
- [🎈 Streamlit + LLM Examples App](https://github.com/streamlit/llm-examples)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import pandas as pd
2+
import streamlit as st
3+
from dotenv import load_dotenv
4+
5+
load_dotenv()
6+
7+
8+
with st.sidebar:
9+
"[Azure Portal](https://portal.azure.com/)"
10+
"[Azure OpenAI Studio](https://oai.azure.com/resource/overview)"
11+
"[View the source code](https://github.com/ks6088ts-labs/workshop-azure-openai/blob/main/apps/99_streamlit_examples/pages/8_Visualize_location.py)"
12+
13+
st.title("Visualize location")
14+
st.info("This is a sample to visualize location.")
15+
16+
uploaded_file = st.file_uploader("Upload an article", type=("csv"))
17+
if uploaded_file:
18+
df = pd.read_csv(uploaded_file)
19+
st.map(
20+
data=df,
21+
size=1,
22+
)

apps/6_call_azure_ai_search/data/contoso_rules.txt renamed to datasets/contoso_rules.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ Working during a full moon is prohibited.
2727
Every employee must bring a homemade snack once a month.
2828
The company logo must always include a smiley face.
2929
Office plants must be watered by the person with the longest name.
30-
Every Friday, employees must write a haiku about their day.
30+
Every Friday, employees must write a haiku about their day.

datasets/locations.csv

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
time,latitude,longitude
2+
12:00, 35.0116, 135.7681
3+
12:01, 35.0120, 135.7685
4+
12:02, 35.0124, 135.7689
5+
12:03, 35.0128, 135.7693
6+
12:04, 35.0132, 135.7697
7+
12:05, 35.0136, 135.7701
8+
12:06, 35.0140, 135.7705
9+
12:07, 35.0144, 135.7709
10+
12:08, 35.0148, 135.7713
11+
12:09, 35.0152, 135.7717
12+
12:10, 35.0156, 135.7721
13+
12:11, 35.0160, 135.7725
14+
12:12, 35.0164, 135.7729
15+
12:13, 35.0168, 135.7733
16+
12:14, 35.0172, 135.7737
17+
12:15, 35.0176, 135.7741
18+
12:16, 35.0180, 135.7745
19+
12:17, 35.0184, 135.7749
20+
12:18, 35.0188, 135.7753
21+
12:19, 35.0192, 135.7757
22+
12:20, 35.0196, 135.7761
23+
12:21, 35.0200, 135.7765
24+
12:22, 35.0204, 135.7769
25+
12:23, 35.0208, 135.7773
26+
12:24, 35.0212, 135.7777
27+
12:25, 35.0216, 135.7781
28+
12:26, 35.0220, 135.7785
29+
12:27, 35.0224, 135.7789
30+
12:28, 35.0228, 135.7793
31+
12:29, 35.0232, 135.7797
32+
12:30, 35.0236, 135.7801
497 KB
Loading

0 commit comments

Comments
 (0)