Spaces:
Configuration error
Configuration error
Update app.py to change local model selection and refine default system message formatting. Simplify layout by removing unnecessary row wrappers in Gradio interface and add advanced settings accordion for ChatInterface.
Browse files
app.py
CHANGED
|
@@ -5,9 +5,9 @@ import base64
|
|
| 5 |
from pathlib import Path
|
| 6 |
|
| 7 |
# Configuration
|
| 8 |
-
LOCAL_MODELS = ["
|
| 9 |
API_MODELS = ["openai/gpt-oss-20b", "meta-llama/Meta-Llama-3-8B-Instruct"]
|
| 10 |
-
DEFAULT_SYSTEM_MESSAGE = "You are an expert assistant for Magic: The Gathering. You're name is Smart Confidant but people tend to call you Bob."
|
| 11 |
TITLE = "ππ§π»ββοΈ Smart Confidant π§π»ββοΈπ"
|
| 12 |
|
| 13 |
# Create model options with labels
|
|
@@ -142,10 +142,8 @@ def respond(
|
|
| 142 |
|
| 143 |
|
| 144 |
with gr.Blocks(css=fancy_css) as demo:
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
with gr.Row():
|
| 148 |
-
gr.Markdown(f"<h1 style='text-align: center;'>{TITLE}</h1>")
|
| 149 |
|
| 150 |
# Create custom chatbot with avatar images
|
| 151 |
chatbot = gr.Chatbot(
|
|
@@ -153,7 +151,7 @@ with gr.Blocks(css=fancy_css) as demo:
|
|
| 153 |
avatar_images=(str(ASSETS_DIR / "monster_icon.png"), str(ASSETS_DIR / "smart_confidant_icon.png"))
|
| 154 |
)
|
| 155 |
|
| 156 |
-
# Create ChatInterface with the custom chatbot
|
| 157 |
gr.ChatInterface(
|
| 158 |
fn=respond,
|
| 159 |
chatbot=chatbot,
|
|
@@ -164,6 +162,7 @@ with gr.Blocks(css=fancy_css) as demo:
|
|
| 164 |
gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)"),
|
| 165 |
gr.Radio(choices=MODEL_OPTIONS, label="Select Model", value=MODEL_OPTIONS[2]),
|
| 166 |
],
|
|
|
|
| 167 |
type="messages",
|
| 168 |
)
|
| 169 |
|
|
|
|
| 5 |
from pathlib import Path
|
| 6 |
|
| 7 |
# Configuration
|
| 8 |
+
LOCAL_MODELS = ["tiiuae/Falcon-H1-0.5B-Instruct", "microsoft/Phi-3-mini-4k-instruct"]
|
| 9 |
API_MODELS = ["openai/gpt-oss-20b", "meta-llama/Meta-Llama-3-8B-Instruct"]
|
| 10 |
+
DEFAULT_SYSTEM_MESSAGE = "You are an expert assistant for Magic: The Gathering. You're name is Smart Confidant, but people tend to call you Bob."
|
| 11 |
TITLE = "ππ§π»ββοΈ Smart Confidant π§π»ββοΈπ"
|
| 12 |
|
| 13 |
# Create model options with labels
|
|
|
|
| 142 |
|
| 143 |
|
| 144 |
with gr.Blocks(css=fancy_css) as demo:
|
| 145 |
+
gr.LoginButton()
|
| 146 |
+
gr.Markdown(f"<h1 style='text-align: center;'>{TITLE}</h1>")
|
|
|
|
|
|
|
| 147 |
|
| 148 |
# Create custom chatbot with avatar images
|
| 149 |
chatbot = gr.Chatbot(
|
|
|
|
| 151 |
avatar_images=(str(ASSETS_DIR / "monster_icon.png"), str(ASSETS_DIR / "smart_confidant_icon.png"))
|
| 152 |
)
|
| 153 |
|
| 154 |
+
# Create ChatInterface with the custom chatbot and additional inputs in accordion below
|
| 155 |
gr.ChatInterface(
|
| 156 |
fn=respond,
|
| 157 |
chatbot=chatbot,
|
|
|
|
| 162 |
gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)"),
|
| 163 |
gr.Radio(choices=MODEL_OPTIONS, label="Select Model", value=MODEL_OPTIONS[2]),
|
| 164 |
],
|
| 165 |
+
additional_inputs_accordion=gr.Accordion("Advanced Settings", open=False),
|
| 166 |
type="messages",
|
| 167 |
)
|
| 168 |
|