Jaywalker061707 commited on
Commit
ccc9144
·
verified ·
1 Parent(s): 95210e5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -3
app.py CHANGED
@@ -1,7 +1,21 @@
1
  import gradio as gr
 
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
7
  demo.launch()
 
1
  import gradio as gr
2
+ from datasets import load_dataset
3
+ from itertools import islice
4
 
5
+ def stream_test(n=50):
6
+ try:
7
+ ds = load_dataset("MultimodalUniverse/jwst", split="train", streaming=True)
8
+ count = sum(1 for _ in islice(ds, int(n)))
9
+ return f"OK. Streamed {count} JWST records without downloading the full dataset."
10
+ except Exception as e:
11
+ return f"Error: {e}"
12
+
13
+ demo = gr.Interface(
14
+ fn=stream_test,
15
+ inputs=gr.Slider(minimum=1, maximum=200, value=50, step=1, label="How many records to stream"),
16
+ outputs="text",
17
+ title="JWST streaming check",
18
+ description="Test that we can stream data from the JWST dataset in small batches."
19
+ )
20
 
 
21
  demo.launch()