Skip to content

Commit

Permalink
visualize location demo
Browse files Browse the repository at this point in the history
  • Loading branch information
ks6088ts committed Aug 12, 2024
1 parent 20db96b commit 705d7c0
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ repos:
rev: 24.2.0
hooks:
- id: black
exclude: 'generated/.*|artifacts/.*|.jsonl'
exclude: 'generated/.*|artifacts/.*|.jsonl|.csv'
2 changes: 1 addition & 1 deletion apps/6_call_azure_ai_search/1_create_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

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


Expand Down
4 changes: 4 additions & 0 deletions apps/99_streamlit_examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ Access to http://localhost:8501 and select the sample you want to run from the s

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

#### 8. Visualize location

![Visualize location](../../docs/images/99_streamlit_examples.map.png)

## References

- [🎈 Streamlit + LLM Examples App](https://github.com/streamlit/llm-examples)
Expand Down
22 changes: 22 additions & 0 deletions apps/99_streamlit_examples/pages/8_Visualize_location.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import pandas as pd
import streamlit as st
from dotenv import load_dotenv

load_dotenv()


with st.sidebar:
"[Azure Portal](https://portal.azure.com/)"
"[Azure OpenAI Studio](https://oai.azure.com/resource/overview)"
"[View the source code](https://github.com/ks6088ts-labs/workshop-azure-openai/blob/main/apps/99_streamlit_examples/pages/8_Visualize_location.py)"

st.title("Visualize location")
st.info("This is a sample to visualize location.")

uploaded_file = st.file_uploader("Upload an article", type=("csv"))
if uploaded_file:
df = pd.read_csv(uploaded_file)
st.map(
data=df,
size=1,
)
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ Working during a full moon is prohibited.
Every employee must bring a homemade snack once a month.
The company logo must always include a smiley face.
Office plants must be watered by the person with the longest name.
Every Friday, employees must write a haiku about their day.
Every Friday, employees must write a haiku about their day.
32 changes: 32 additions & 0 deletions datasets/locations.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
time,latitude,longitude
12:00, 35.0116, 135.7681
12:01, 35.0120, 135.7685
12:02, 35.0124, 135.7689
12:03, 35.0128, 135.7693
12:04, 35.0132, 135.7697
12:05, 35.0136, 135.7701
12:06, 35.0140, 135.7705
12:07, 35.0144, 135.7709
12:08, 35.0148, 135.7713
12:09, 35.0152, 135.7717
12:10, 35.0156, 135.7721
12:11, 35.0160, 135.7725
12:12, 35.0164, 135.7729
12:13, 35.0168, 135.7733
12:14, 35.0172, 135.7737
12:15, 35.0176, 135.7741
12:16, 35.0180, 135.7745
12:17, 35.0184, 135.7749
12:18, 35.0188, 135.7753
12:19, 35.0192, 135.7757
12:20, 35.0196, 135.7761
12:21, 35.0200, 135.7765
12:22, 35.0204, 135.7769
12:23, 35.0208, 135.7773
12:24, 35.0212, 135.7777
12:25, 35.0216, 135.7781
12:26, 35.0220, 135.7785
12:27, 35.0224, 135.7789
12:28, 35.0228, 135.7793
12:29, 35.0232, 135.7797
12:30, 35.0236, 135.7801
Binary file added docs/images/99_streamlit_examples.map.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 705d7c0

Please sign in to comment.