Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,7 +9,7 @@ async def get_splits(dataset_name: str) -> Dict[str, List[Dict]]:
|
|
| 9 |
response = await session.get(URL)
|
| 10 |
return response.json()
|
| 11 |
|
| 12 |
-
async def
|
| 13 |
URL = f"https://datasets-server.huggingface.co/valid"
|
| 14 |
async with httpx.AsyncClient() as session:
|
| 15 |
response = await session.get(URL)
|
|
@@ -18,6 +18,17 @@ async def get_valid_datasets() -> Dict[str, List[str]]:
|
|
| 18 |
# The one to watch: https://huggingface.co/rungalileo
|
| 19 |
# rungalileo/medical_transcription_40
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
async def get_first_rows(dataset: str, config: str, split: str) -> Dict[str, Dict[str, List[Dict]]]:
|
| 22 |
URL = f"https://datasets-server.huggingface.co/first-rows?dataset={dataset}&config={config}&split={split}"
|
| 23 |
async with httpx.AsyncClient() as session:
|
|
@@ -77,8 +88,9 @@ with gr.Blocks() as demo:
|
|
| 77 |
URLcenter = gr.Textbox(label="Dataset URL", placeholder="URL")
|
| 78 |
btn = gr.Button("Use Dataset")
|
| 79 |
#URLoutput = gr.Textbox(label="Output",placeholder="URL Output")
|
| 80 |
-
URLoutput = gr.HTML(label="Output",placeholder="URL Output")
|
| 81 |
-
|
|
|
|
| 82 |
with gr.Row():
|
| 83 |
dataset = gr.DataFrame(wrap=True, interactive=True)
|
| 84 |
|
|
|
|
| 9 |
response = await session.get(URL)
|
| 10 |
return response.json()
|
| 11 |
|
| 12 |
+
async def get_valid_datasets_old() -> Dict[str, List[str]]:
|
| 13 |
URL = f"https://datasets-server.huggingface.co/valid"
|
| 14 |
async with httpx.AsyncClient() as session:
|
| 15 |
response = await session.get(URL)
|
|
|
|
| 18 |
# The one to watch: https://huggingface.co/rungalileo
|
| 19 |
# rungalileo/medical_transcription_40
|
| 20 |
|
| 21 |
+
async def get_valid_datasets() -> Dict[str, List[str]]:
|
| 22 |
+
URL = f"https://datasets-server.huggingface.co/valid"
|
| 23 |
+
async with httpx.AsyncClient() as session:
|
| 24 |
+
response = await session.get(URL)
|
| 25 |
+
try:
|
| 26 |
+
datasets = response.json()["valid"]
|
| 27 |
+
except (KeyError, json.JSONDecodeError):
|
| 28 |
+
datasets = [] # Set a default value if the response is not in the expected format
|
| 29 |
+
return gr.Dropdown.update(choices=datasets, value="awacke1/ChatbotMemory.csv")
|
| 30 |
+
|
| 31 |
+
|
| 32 |
async def get_first_rows(dataset: str, config: str, split: str) -> Dict[str, Dict[str, List[Dict]]]:
|
| 33 |
URL = f"https://datasets-server.huggingface.co/first-rows?dataset={dataset}&config={config}&split={split}"
|
| 34 |
async with httpx.AsyncClient() as session:
|
|
|
|
| 88 |
URLcenter = gr.Textbox(label="Dataset URL", placeholder="URL")
|
| 89 |
btn = gr.Button("Use Dataset")
|
| 90 |
#URLoutput = gr.Textbox(label="Output",placeholder="URL Output")
|
| 91 |
+
#URLoutput = gr.HTML(label="Output",placeholder="URL Output")
|
| 92 |
+
URLoutput = gr.HTML(label="Output")
|
| 93 |
+
|
| 94 |
with gr.Row():
|
| 95 |
dataset = gr.DataFrame(wrap=True, interactive=True)
|
| 96 |
|