Spaces:
Sleeping
Sleeping
added dataset server
Browse files
app.py
CHANGED
@@ -1,10 +1,36 @@
|
|
1 |
import streamlit as st
|
|
|
|
|
2 |
|
|
|
3 |
x = st.slider('Select a value')
|
4 |
st.write(x, 'squared is', x * x)
|
5 |
|
6 |
-
from datasets
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
+
import requests
|
3 |
+
import pandas as pd
|
4 |
|
5 |
+
# Slider to select a value
|
6 |
x = st.slider('Select a value')
|
7 |
st.write(x, 'squared is', x * x)
|
8 |
|
9 |
+
# Function to get data from Hugging Face datasets server
|
10 |
+
def get_arxiv_data():
|
11 |
+
url = "https://datasets-server.huggingface.co/first-rows?dataset=arxiv_dataset&config=default&split=train"
|
12 |
+
response = requests.get(url)
|
13 |
+
if response.status_code == 200:
|
14 |
+
return response.json()
|
15 |
+
else:
|
16 |
+
st.error("Failed to retrieve data")
|
17 |
+
return None
|
18 |
|
19 |
+
# Button to load data
|
20 |
+
if st.button('Load ArXiv Data'):
|
21 |
+
data = get_arxiv_data()
|
22 |
+
if data:
|
23 |
+
# Assuming the data is in a format that can be directly converted to a DataFrame
|
24 |
+
df = pd.DataFrame(data)
|
25 |
+
st.write(df)
|
26 |
|
27 |
+
# import streamlit as st
|
28 |
+
|
29 |
+
# x = st.slider('Select a value')
|
30 |
+
# st.write(x, 'squared is', x * x)
|
31 |
+
|
32 |
+
# from datasets import load_dataset
|
33 |
+
|
34 |
+
# dataset = load_dataset("arxiv_dataset", data_dir="")
|
35 |
+
|
36 |
+
# print(dataset)
|