Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -217,33 +217,35 @@ def rank(q: str, rows: T.List[Row]):
|
|
| 217 |
|
| 218 |
# -------------------- Gradio UI --------------------
|
| 219 |
with gr.Blocks(title="Open Dataset Finder (HF • Zenodo • Kaggle)") as demo:
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
|
| 240 |
with gr.Row():
|
| 241 |
q = gr.Textbox(label="Query / Idea", value="korean weather")
|
| 242 |
k = gr.Slider(10, 200, value=40, step=10, label="Results per source")
|
|
|
|
| 243 |
with gr.Row():
|
| 244 |
use_hf = gr.Checkbox(value=True, label="Hugging Face")
|
| 245 |
use_zen = gr.Checkbox(value=True, label="Zenodo")
|
| 246 |
use_kg = gr.Checkbox(value=False, label="Kaggle")
|
|
|
|
| 247 |
btn = gr.Button("Search", variant="primary")
|
| 248 |
out = gr.Dataframe(wrap=True)
|
| 249 |
log = gr.Textbox(label="Logs", lines=8)
|
|
@@ -282,9 +284,7 @@ with gr.Blocks(title="Open Dataset Finder (HF • Zenodo • Kaggle)") as demo:
|
|
| 282 |
btn.click(do_search, inputs=[q,k,use_hf,use_zen,use_kg], outputs=[out, log])
|
| 283 |
|
| 284 |
# -------------------- Run (Gradio + MCP) --------------------
|
| 285 |
-
# On Hugging Face Spaces, calling launch() here is fine.
|
| 286 |
if __name__ == "__main__":
|
| 287 |
-
# IMPORTANT: mcp_server=True exposes MCP endpoints while keeping UI at root.
|
| 288 |
demo.queue().launch(
|
| 289 |
server_name="0.0.0.0",
|
| 290 |
server_port=7860,
|
|
|
|
| 217 |
|
| 218 |
# -------------------- Gradio UI --------------------
|
| 219 |
with gr.Blocks(title="Open Dataset Finder (HF • Zenodo • Kaggle)") as demo:
|
| 220 |
+
gr.Markdown(
|
| 221 |
+
"""
|
| 222 |
+
# 🔍 Open Dataset Finder
|
| 223 |
+
|
| 224 |
+
This app lets you search datasets from multiple open data sources.
|
| 225 |
+
|
| 226 |
+
- **Hugging Face Datasets**: Public machine learning datasets for NLP, computer vision, speech, and more.
|
| 227 |
+
- **Zenodo**: Research datasets shared by scientists and institutions, often linked to academic publications.
|
| 228 |
+
- **Kaggle**: Community datasets, competition datasets, and practice datasets shared on Kaggle.
|
| 229 |
+
|
| 230 |
+
### Kaggle authentication
|
| 231 |
+
To enable Kaggle search, you need to add your Kaggle API credentials as **Repository secrets** in the Space settings:
|
| 232 |
+
|
| 233 |
+
- `KAGGLE_USERNAME`: your Kaggle username
|
| 234 |
+
- `KAGGLE_KEY`: your Kaggle API token (found in the `kaggle.json` file you can download from your Kaggle account)
|
| 235 |
+
|
| 236 |
+
Once the secrets are set, you can check the Kaggle box in the UI and search Kaggle datasets directly here.
|
| 237 |
+
"""
|
| 238 |
+
)
|
| 239 |
|
| 240 |
with gr.Row():
|
| 241 |
q = gr.Textbox(label="Query / Idea", value="korean weather")
|
| 242 |
k = gr.Slider(10, 200, value=40, step=10, label="Results per source")
|
| 243 |
+
|
| 244 |
with gr.Row():
|
| 245 |
use_hf = gr.Checkbox(value=True, label="Hugging Face")
|
| 246 |
use_zen = gr.Checkbox(value=True, label="Zenodo")
|
| 247 |
use_kg = gr.Checkbox(value=False, label="Kaggle")
|
| 248 |
+
|
| 249 |
btn = gr.Button("Search", variant="primary")
|
| 250 |
out = gr.Dataframe(wrap=True)
|
| 251 |
log = gr.Textbox(label="Logs", lines=8)
|
|
|
|
| 284 |
btn.click(do_search, inputs=[q,k,use_hf,use_zen,use_kg], outputs=[out, log])
|
| 285 |
|
| 286 |
# -------------------- Run (Gradio + MCP) --------------------
|
|
|
|
| 287 |
if __name__ == "__main__":
|
|
|
|
| 288 |
demo.queue().launch(
|
| 289 |
server_name="0.0.0.0",
|
| 290 |
server_port=7860,
|