Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
import requests
|
|
|
3 |
from datasets import load_dataset
|
4 |
|
5 |
#dataset = load_dataset("nlphuji/flickr30k", split="test[10:20]")
|
@@ -22,8 +23,8 @@ def query2(fetch_url):
|
|
22 |
API_URL2 = f"https://datasets-server.huggingface.co/rows?dataset={fetch_url}&config=TEST&split=test&offset=150&length=10"
|
23 |
|
24 |
response = requests.get(API_URL2)
|
25 |
-
|
26 |
-
json_object=
|
27 |
# Writing to sample.json
|
28 |
with open("sample.json", "w") as outfile:
|
29 |
outfile.write(json_object)
|
|
|
1 |
import gradio as gr
|
2 |
import requests
|
3 |
+
import json
|
4 |
from datasets import load_dataset
|
5 |
|
6 |
#dataset = load_dataset("nlphuji/flickr30k", split="test[10:20]")
|
|
|
23 |
API_URL2 = f"https://datasets-server.huggingface.co/rows?dataset={fetch_url}&config=TEST&split=test&offset=150&length=10"
|
24 |
|
25 |
response = requests.get(API_URL2)
|
26 |
+
dictionary=response.json()
|
27 |
+
json_object = json.dumps(dictionary, indent=4)
|
28 |
# Writing to sample.json
|
29 |
with open("sample.json", "w") as outfile:
|
30 |
outfile.write(json_object)
|