Spaces:
Sleeping
Sleeping
show connection to hf dataset
Browse files- pages/HF_Dataset.py +28 -0
- requirements.txt +1 -0
pages/HF_Dataset.py
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import pandas as pd
|
3 |
+
from huggingface_hub import hf_hub_download
|
4 |
+
import os
|
5 |
+
|
6 |
+
# Set your Hugging Face token from environment variable
|
7 |
+
hf_token = os.getenv("pegelonline_dataset_read_only")
|
8 |
+
|
9 |
+
if hf_token is None:
|
10 |
+
st.error("Hugging Face token not found. Please set the HF_TOKEN environment variable.")
|
11 |
+
else:
|
12 |
+
# Download the dataset file
|
13 |
+
dataset_path = hf_hub_download(
|
14 |
+
repo_id="DSSG-Wasserwacht/pegelonline-dataset",
|
15 |
+
filename="processed/stations.parquet",
|
16 |
+
repo_type="dataset",
|
17 |
+
use_auth_token=hf_token
|
18 |
+
)
|
19 |
+
|
20 |
+
# Load the dataset
|
21 |
+
df = pd.read_parquet(dataset_path)
|
22 |
+
|
23 |
+
# Streamlit app
|
24 |
+
st.title("Pegelonline Dataset Viewer")
|
25 |
+
st.write("This app displays data from the Pegelonline dataset.")
|
26 |
+
|
27 |
+
# Display the dataframe
|
28 |
+
st.dataframe(df)
|
requirements.txt
CHANGED
@@ -4,3 +4,4 @@ pandas
|
|
4 |
geopandas
|
5 |
pydeck
|
6 |
altair
|
|
|
|
4 |
geopandas
|
5 |
pydeck
|
6 |
altair
|
7 |
+
huggingface_hub
|