Update app.py
Browse files
app.py
CHANGED
@@ -500,7 +500,7 @@ with gr.Blocks(
|
|
500 |
margin-bottom: 20px;
|
501 |
}
|
502 |
""") as demo:
|
503 |
-
|
504 |
with gr.Row():
|
505 |
gr.HTML("""
|
506 |
<div class="main-header">
|
@@ -508,7 +508,6 @@ with gr.Blocks(
|
|
508 |
<p>Get comprehensive documentation with <strong>real code examples</strong>, <strong>usage instructions</strong>, and <strong>practical content</strong></p>
|
509 |
</div>
|
510 |
""")
|
511 |
-
|
512 |
with gr.Tab("π Documentation Search", elem_id="docs"):
|
513 |
gr.Markdown("### Search for documentation with **comprehensive code examples** and **step-by-step instructions**")
|
514 |
with gr.Row():
|
@@ -528,7 +527,6 @@ with gr.Blocks(
|
|
528 |
gr.Button("PEFT", size="sm").click(lambda: "peft", outputs=doc_query)
|
529 |
doc_btn.click(lambda q, m: hf_server.search_documentation(q, int(m) if str(m).isdigit() else 2), inputs=[doc_query, doc_max_results], outputs=doc_output)
|
530 |
doc_clear.click(lambda: "", outputs=doc_output)
|
531 |
-
|
532 |
with gr.Tab("π€ Model Information", elem_id="models"):
|
533 |
gr.Markdown("### Get detailed model information with **usage examples** and **code snippets**")
|
534 |
model_name = gr.Textbox(label="π€ Model Name", placeholder="e.g., bert-base-uncased, gpt2, microsoft/DialoGPT-medium, meta-llama/Llama-2-7b-hf")
|
@@ -544,7 +542,6 @@ with gr.Blocks(
|
|
544 |
gr.Button("DistilBERT", size="sm").click(lambda: "distilbert-base-uncased", outputs=model_name)
|
545 |
model_btn.click(hf_server.get_model_info, inputs=model_name, outputs=model_output)
|
546 |
model_clear.click(lambda: "", outputs=model_output)
|
547 |
-
|
548 |
with gr.Tab("π Dataset Information", elem_id="datasets"):
|
549 |
gr.Markdown("### Get dataset information with **loading examples** and **usage code**")
|
550 |
dataset_name = gr.Textbox(label="π Dataset Name", placeholder="e.g., squad, imdb, glue, common_voice, wikitext")
|
@@ -560,7 +557,6 @@ with gr.Blocks(
|
|
560 |
gr.Button("Common Voice", size="sm").click(lambda: "common_voice", outputs=dataset_name)
|
561 |
dataset_btn.click(hf_server.get_dataset_info, inputs=dataset_name, outputs=dataset_output)
|
562 |
dataset_clear.click(lambda: "", outputs=dataset_output)
|
563 |
-
|
564 |
with gr.Tab("π Model Search", elem_id="search"):
|
565 |
gr.Markdown("### Search models with **quick usage examples** and **quality indicators**")
|
566 |
with gr.Row():
|
@@ -580,7 +576,6 @@ with gr.Blocks(
|
|
580 |
gr.Button("Image Classification", size="sm").click(lambda: "image-classification", outputs=search_task)
|
581 |
search_btn.click(lambda task, limit: hf_server.search_models(task, int(limit) if str(limit).isdigit() else 5), inputs=[search_task, search_limit], outputs=search_output)
|
582 |
search_clear.click(lambda: "", outputs=search_output)
|
583 |
-
|
584 |
with gr.Tab("β‘ Transformers Docs", elem_id="transformers"):
|
585 |
gr.Markdown("### Get comprehensive Transformers documentation with **detailed examples** and **parameters**")
|
586 |
transformers_topic = gr.Textbox(label="π Topic", placeholder="e.g., pipeline, tokenizer, trainer, model, peft, generation, quantization")
|
@@ -596,7 +591,6 @@ with gr.Blocks(
|
|
596 |
gr.Button("Generation", size="sm").click(lambda: "generation", outputs=transformers_topic)
|
597 |
transformers_btn.click(hf_server.get_transformers_docs, inputs=transformers_topic, outputs=transformers_output)
|
598 |
transformers_clear.click(lambda: "", outputs=transformers_output)
|
599 |
-
|
600 |
with gr.Tab("π₯ Trending Models", elem_id="trending"):
|
601 |
gr.Markdown("### Discover the most popular and trending models")
|
602 |
trending_limit = gr.Number(label="Number of Models", value=10, minimum=1, maximum=20)
|
@@ -606,7 +600,6 @@ with gr.Blocks(
|
|
606 |
trending_clear = gr.Button("ποΈ Clear", variant="secondary")
|
607 |
trending_btn.click(lambda limit: hf_server.get_trending_models(int(limit) if str(limit).isdigit() else 10), inputs=trending_limit, outputs=trending_output)
|
608 |
trending_clear.click(lambda: "", outputs=trending_output)
|
609 |
-
|
610 |
# Footer
|
611 |
with gr.Row():
|
612 |
gr.HTML("""
|
@@ -614,7 +607,7 @@ with gr.Blocks(
|
|
614 |
<h3>π‘ Features</h3>
|
615 |
<p><strong>β
Real code examples</strong> β’ <strong>β
Step-by-step instructions</strong> β’ <strong>β
Parameter documentation</strong> β’ <strong>β
Quality indicators</strong></p>
|
616 |
<p><em>Get practical, actionable information, directly from the source.</em></p>
|
617 |
-
<p><a href="https://huggingface.co/spaces/Agents-MCP-Hackathon/HuggingFaceDoc/blob/main/README.md" target="_blank"
|
618 |
</div>
|
619 |
""")
|
620 |
|
@@ -624,6 +617,6 @@ if __name__ == "__main__":
|
|
624 |
demo.launch(
|
625 |
server_name="0.0.0.0",
|
626 |
server_port=7860,
|
627 |
-
|
628 |
-
|
629 |
)
|
|
|
500 |
margin-bottom: 20px;
|
501 |
}
|
502 |
""") as demo:
|
503 |
+
# Header
|
504 |
with gr.Row():
|
505 |
gr.HTML("""
|
506 |
<div class="main-header">
|
|
|
508 |
<p>Get comprehensive documentation with <strong>real code examples</strong>, <strong>usage instructions</strong>, and <strong>practical content</strong></p>
|
509 |
</div>
|
510 |
""")
|
|
|
511 |
with gr.Tab("π Documentation Search", elem_id="docs"):
|
512 |
gr.Markdown("### Search for documentation with **comprehensive code examples** and **step-by-step instructions**")
|
513 |
with gr.Row():
|
|
|
527 |
gr.Button("PEFT", size="sm").click(lambda: "peft", outputs=doc_query)
|
528 |
doc_btn.click(lambda q, m: hf_server.search_documentation(q, int(m) if str(m).isdigit() else 2), inputs=[doc_query, doc_max_results], outputs=doc_output)
|
529 |
doc_clear.click(lambda: "", outputs=doc_output)
|
|
|
530 |
with gr.Tab("π€ Model Information", elem_id="models"):
|
531 |
gr.Markdown("### Get detailed model information with **usage examples** and **code snippets**")
|
532 |
model_name = gr.Textbox(label="π€ Model Name", placeholder="e.g., bert-base-uncased, gpt2, microsoft/DialoGPT-medium, meta-llama/Llama-2-7b-hf")
|
|
|
542 |
gr.Button("DistilBERT", size="sm").click(lambda: "distilbert-base-uncased", outputs=model_name)
|
543 |
model_btn.click(hf_server.get_model_info, inputs=model_name, outputs=model_output)
|
544 |
model_clear.click(lambda: "", outputs=model_output)
|
|
|
545 |
with gr.Tab("π Dataset Information", elem_id="datasets"):
|
546 |
gr.Markdown("### Get dataset information with **loading examples** and **usage code**")
|
547 |
dataset_name = gr.Textbox(label="π Dataset Name", placeholder="e.g., squad, imdb, glue, common_voice, wikitext")
|
|
|
557 |
gr.Button("Common Voice", size="sm").click(lambda: "common_voice", outputs=dataset_name)
|
558 |
dataset_btn.click(hf_server.get_dataset_info, inputs=dataset_name, outputs=dataset_output)
|
559 |
dataset_clear.click(lambda: "", outputs=dataset_output)
|
|
|
560 |
with gr.Tab("π Model Search", elem_id="search"):
|
561 |
gr.Markdown("### Search models with **quick usage examples** and **quality indicators**")
|
562 |
with gr.Row():
|
|
|
576 |
gr.Button("Image Classification", size="sm").click(lambda: "image-classification", outputs=search_task)
|
577 |
search_btn.click(lambda task, limit: hf_server.search_models(task, int(limit) if str(limit).isdigit() else 5), inputs=[search_task, search_limit], outputs=search_output)
|
578 |
search_clear.click(lambda: "", outputs=search_output)
|
|
|
579 |
with gr.Tab("β‘ Transformers Docs", elem_id="transformers"):
|
580 |
gr.Markdown("### Get comprehensive Transformers documentation with **detailed examples** and **parameters**")
|
581 |
transformers_topic = gr.Textbox(label="π Topic", placeholder="e.g., pipeline, tokenizer, trainer, model, peft, generation, quantization")
|
|
|
591 |
gr.Button("Generation", size="sm").click(lambda: "generation", outputs=transformers_topic)
|
592 |
transformers_btn.click(hf_server.get_transformers_docs, inputs=transformers_topic, outputs=transformers_output)
|
593 |
transformers_clear.click(lambda: "", outputs=transformers_output)
|
|
|
594 |
with gr.Tab("π₯ Trending Models", elem_id="trending"):
|
595 |
gr.Markdown("### Discover the most popular and trending models")
|
596 |
trending_limit = gr.Number(label="Number of Models", value=10, minimum=1, maximum=20)
|
|
|
600 |
trending_clear = gr.Button("ποΈ Clear", variant="secondary")
|
601 |
trending_btn.click(lambda limit: hf_server.get_trending_models(int(limit) if str(limit).isdigit() else 10), inputs=trending_limit, outputs=trending_output)
|
602 |
trending_clear.click(lambda: "", outputs=trending_output)
|
|
|
603 |
# Footer
|
604 |
with gr.Row():
|
605 |
gr.HTML("""
|
|
|
607 |
<h3>π‘ Features</h3>
|
608 |
<p><strong>β
Real code examples</strong> β’ <strong>β
Step-by-step instructions</strong> β’ <strong>β
Parameter documentation</strong> β’ <strong>β
Quality indicators</strong></p>
|
609 |
<p><em>Get practical, actionable information, directly from the source.</em></p>
|
610 |
+
<p><a href="https://huggingface.co/spaces/Agents-MCP-Hackathon/HuggingFaceDoc/blob/main/README.md" target="_blank">π Read the Guide on Hugging Face Spaces</a></p>
|
611 |
</div>
|
612 |
""")
|
613 |
|
|
|
617 |
demo.launch(
|
618 |
server_name="0.0.0.0",
|
619 |
server_port=7860,
|
620 |
+
show_error=True,
|
621 |
+
mcp_server=True
|
622 |
)
|