Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -14,7 +14,7 @@ import tempfile
|
|
| 14 |
import shutil
|
| 15 |
import os
|
| 16 |
|
| 17 |
-
#
|
| 18 |
def init_huggingface(token: str):
|
| 19 |
"""Initialize HuggingFace with access token."""
|
| 20 |
try:
|
|
@@ -23,7 +23,8 @@ def init_huggingface(token: str):
|
|
| 23 |
except Exception as e:
|
| 24 |
print(f"Error logging in: {str(e)}")
|
| 25 |
return False
|
| 26 |
-
|
|
|
|
| 27 |
"""Format a link for display in the UI."""
|
| 28 |
link = item['link']
|
| 29 |
readme_link = f"{link}/blob/main/README.md"
|
|
@@ -208,8 +209,7 @@ def create_repo_zip(data: List[Dict], search_type: str, token: str) -> tuple[str
|
|
| 208 |
|
| 209 |
return download_link, f"Successfully downloaded {len(successful_downloads)} repositories"
|
| 210 |
|
| 211 |
-
|
| 212 |
-
|
| 213 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
| 214 |
gr.Markdown("""
|
| 215 |
# Search the Hugging Face Hub
|
|
@@ -271,12 +271,12 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 271 |
aggregated = SwarmyTime(data)
|
| 272 |
html_results = display_results(df)
|
| 273 |
return [
|
| 274 |
-
html_results,
|
| 275 |
-
"Status: Ready to download",
|
| 276 |
-
"",
|
| 277 |
-
aggregated,
|
| 278 |
-
search_type,
|
| 279 |
-
data
|
| 280 |
]
|
| 281 |
|
| 282 |
async def handle_readme_download(data, token):
|
|
|
|
| 14 |
import shutil
|
| 15 |
import os
|
| 16 |
|
| 17 |
+
# Initialize HuggingFace with access token
|
| 18 |
def init_huggingface(token: str):
|
| 19 |
"""Initialize HuggingFace with access token."""
|
| 20 |
try:
|
|
|
|
| 23 |
except Exception as e:
|
| 24 |
print(f"Error logging in: {str(e)}")
|
| 25 |
return False
|
| 26 |
+
|
| 27 |
+
def format_link(item: Dict, number: int, search_type: str) -> str:
|
| 28 |
"""Format a link for display in the UI."""
|
| 29 |
link = item['link']
|
| 30 |
readme_link = f"{link}/blob/main/README.md"
|
|
|
|
| 209 |
|
| 210 |
return download_link, f"Successfully downloaded {len(successful_downloads)} repositories"
|
| 211 |
|
| 212 |
+
# Gradio Interface
|
|
|
|
| 213 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
| 214 |
gr.Markdown("""
|
| 215 |
# Search the Hugging Face Hub
|
|
|
|
| 271 |
aggregated = SwarmyTime(data)
|
| 272 |
html_results = display_results(df)
|
| 273 |
return [
|
| 274 |
+
html_results,
|
| 275 |
+
"Status: Ready to download",
|
| 276 |
+
"",
|
| 277 |
+
aggregated,
|
| 278 |
+
search_type,
|
| 279 |
+
data
|
| 280 |
]
|
| 281 |
|
| 282 |
async def handle_readme_download(data, token):
|