Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from datasets import load_dataset | |
| def peek_schema_text(): | |
| try: | |
| ds = load_dataset("MultimodalUniverse/jwst", split="train", streaming=True) | |
| first = next(iter(ds)) | |
| keys = list(first.keys()) | |
| lines = [f"Keys: {keys}", "Types:"] | |
| lines += [f" {k}: {type(first[k]).__name__}" for k in keys] | |
| # show short previews if any text fields exist | |
| previews = [f" {k}: {first[k][:200]}" for k in keys if isinstance(first[k], str) and first[k]] | |
| if previews: | |
| lines.append("Text previews:") | |
| lines += previews | |
| return "\n".join(lines) | |
| except Exception as e: | |
| return f"Error: {e}" | |
| demo = gr.Interface( | |
| fn=peek_schema_text, | |
| inputs=None, | |
| outputs="text", | |
| title="JWST dataset schema peek", | |
| description="Shows keys and types for the first streamed record." | |
| ) | |
| demo.launch() |