Spaces:
Running
Running
Enhance Chat Support for Gradio/HF Spaces expertise
Browse files- Update Chat Support prompt for Gradio/HF Spaces technical guidance
- Change Chat Support model to meta-llama/llama-3.1-70b-instruct
- Update google/gemma-2-27b-it to google/gemma-3-27b-it
- Add openai/gpt-3.5-turbo to model list
- Update anthropic/claude-3-haiku to anthropic/claude-3.5-haiku
- Pre-populate URL grounding with HF documentation links
app.py
CHANGED
@@ -138,11 +138,12 @@ if __name__ == "__main__":
|
|
138 |
|
139 |
# Available models
|
140 |
MODELS = [
|
141 |
-
"google/gemma-
|
142 |
"mistralai/mixtral-8x7b-instruct",
|
143 |
"meta-llama/llama-3.1-70b-instruct",
|
144 |
-
"anthropic/claude-3-haiku",
|
145 |
-
"nvidia/nemotron-4-340b-instruct"
|
|
|
146 |
]
|
147 |
|
148 |
def fetch_url_content(url):
|
@@ -394,13 +395,15 @@ def respond(message, chat_history, url1="", url2="", url3="", url4=""):
|
|
394 |
grounding_context = get_grounding_context(grounding_urls)
|
395 |
|
396 |
# Build enhanced system prompt with grounding context
|
397 |
-
base_system_prompt = """You are
|
398 |
-
-
|
399 |
-
-
|
400 |
-
-
|
401 |
-
-
|
|
|
|
|
402 |
|
403 |
-
|
404 |
|
405 |
enhanced_system_prompt = base_system_prompt + grounding_context
|
406 |
|
@@ -431,7 +434,7 @@ Keep responses brief and actionable. Focus on what the user is specifically aski
|
|
431 |
"Content-Type": "application/json"
|
432 |
},
|
433 |
json={
|
434 |
-
"model": "
|
435 |
"messages": messages,
|
436 |
"temperature": 0.7,
|
437 |
"max_tokens": 500
|
@@ -578,23 +581,23 @@ with gr.Blocks(title="Chat U/I Helper") as demo:
|
|
578 |
gr.Markdown("Add URLs to provide additional context for more informed responses")
|
579 |
chat_url1 = gr.Textbox(
|
580 |
label="URL 1",
|
581 |
-
|
582 |
-
info="
|
583 |
)
|
584 |
chat_url2 = gr.Textbox(
|
585 |
label="URL 2",
|
586 |
-
|
587 |
-
info="
|
588 |
)
|
589 |
chat_url3 = gr.Textbox(
|
590 |
label="URL 3",
|
591 |
-
|
592 |
-
info="
|
593 |
)
|
594 |
chat_url4 = gr.Textbox(
|
595 |
label="URL 4",
|
596 |
-
|
597 |
-
info="
|
598 |
)
|
599 |
with gr.Row():
|
600 |
submit = gr.Button("Send", variant="primary")
|
|
|
138 |
|
139 |
# Available models
|
140 |
MODELS = [
|
141 |
+
"google/gemma-3-27b-it",
|
142 |
"mistralai/mixtral-8x7b-instruct",
|
143 |
"meta-llama/llama-3.1-70b-instruct",
|
144 |
+
"anthropic/claude-3.5-haiku",
|
145 |
+
"nvidia/nemotron-4-340b-instruct",
|
146 |
+
"openai/gpt-3.5-turbo"
|
147 |
]
|
148 |
|
149 |
def fetch_url_content(url):
|
|
|
395 |
grounding_context = get_grounding_context(grounding_urls)
|
396 |
|
397 |
# Build enhanced system prompt with grounding context
|
398 |
+
base_system_prompt = """You are an expert assistant specializing in Gradio configurations for HuggingFace Spaces. You have deep knowledge of:
|
399 |
+
- Gradio interface components and layouts
|
400 |
+
- HuggingFace Spaces configuration (YAML frontmatter, secrets, environment variables)
|
401 |
+
- Deployment best practices for Gradio apps on HuggingFace
|
402 |
+
- Space settings, SDK versions, and hardware requirements
|
403 |
+
- Troubleshooting common Gradio and HuggingFace Spaces issues
|
404 |
+
- Integration with various APIs and models through Gradio interfaces
|
405 |
|
406 |
+
Provide specific, technical guidance focused on Gradio implementation details and HuggingFace Spaces deployment. Include code examples when relevant. Keep responses concise and actionable."""
|
407 |
|
408 |
enhanced_system_prompt = base_system_prompt + grounding_context
|
409 |
|
|
|
434 |
"Content-Type": "application/json"
|
435 |
},
|
436 |
json={
|
437 |
+
"model": "meta-llama/llama-3.1-70b-instruct",
|
438 |
"messages": messages,
|
439 |
"temperature": 0.7,
|
440 |
"max_tokens": 500
|
|
|
581 |
gr.Markdown("Add URLs to provide additional context for more informed responses")
|
582 |
chat_url1 = gr.Textbox(
|
583 |
label="URL 1",
|
584 |
+
value="https://huggingface.co/docs/hub/en/spaces-overview",
|
585 |
+
info="HuggingFace Spaces Overview"
|
586 |
)
|
587 |
chat_url2 = gr.Textbox(
|
588 |
label="URL 2",
|
589 |
+
value="https://huggingface.co/docs/hub/en/spaces-config-reference",
|
590 |
+
info="Spaces Configuration Reference"
|
591 |
)
|
592 |
chat_url3 = gr.Textbox(
|
593 |
label="URL 3",
|
594 |
+
value="https://huggingface.co/docs/hub/en/spaces-settings",
|
595 |
+
info="Spaces Settings Documentation"
|
596 |
)
|
597 |
chat_url4 = gr.Textbox(
|
598 |
label="URL 4",
|
599 |
+
value="https://huggingface.co/docs/hub/en/spaces-sdks-gradio",
|
600 |
+
info="Gradio SDK for Spaces"
|
601 |
)
|
602 |
with gr.Row():
|
603 |
submit = gr.Button("Send", variant="primary")
|