Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,6 +6,7 @@ import yaml
|
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
|
| 8 |
from Gradio_UI import GradioUI
|
|
|
|
| 9 |
|
| 10 |
|
| 11 |
|
|
@@ -86,4 +87,75 @@ agent = CodeAgent(
|
|
| 86 |
)
|
| 87 |
|
| 88 |
|
| 89 |
-
GradioUI(agent).launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
+
import gradio as gr
|
| 10 |
|
| 11 |
|
| 12 |
|
|
|
|
| 87 |
)
|
| 88 |
|
| 89 |
|
| 90 |
+
# GradioUI(agent).launch()
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
css = """
|
| 94 |
+
.message-row {
|
| 95 |
+
justify-content: space-evenly !important;
|
| 96 |
+
}
|
| 97 |
+
.message-bubble-border {
|
| 98 |
+
border-radius: 6px !important;
|
| 99 |
+
}
|
| 100 |
+
.message-buttons-bot, .message-buttons-user {
|
| 101 |
+
right: 10px !important;
|
| 102 |
+
left: auto !important;
|
| 103 |
+
bottom: 2px !important;
|
| 104 |
+
}
|
| 105 |
+
.dark.message-bubble-border {
|
| 106 |
+
border-color: #15172c !important;
|
| 107 |
+
}
|
| 108 |
+
.dark.user {
|
| 109 |
+
background: #10132c !important;
|
| 110 |
+
}
|
| 111 |
+
.dark.assistant.dark, .dark.pending.dark {
|
| 112 |
+
background: #020417 !important;
|
| 113 |
+
}
|
| 114 |
+
"""
|
| 115 |
+
|
| 116 |
+
# Create Gradio interface
|
| 117 |
+
gr.ChatInterface(
|
| 118 |
+
predict,
|
| 119 |
+
title=EMOJI + " " + MODEL_NAME,
|
| 120 |
+
description=DESCRIPTION,
|
| 121 |
+
examples=[
|
| 122 |
+
["Can you solve the equation 2x + 3 = 11 for x?"],
|
| 123 |
+
["Write an epic poem about Ancient Rome."],
|
| 124 |
+
["Who was the first person to walk on the Moon?"],
|
| 125 |
+
["Use a list comprehension to create a list of squares for numbers from 1 to 10."],
|
| 126 |
+
["Recommend some popular science fiction books."],
|
| 127 |
+
["Can you write a short story about a time-traveling detective?"]
|
| 128 |
+
],
|
| 129 |
+
additional_inputs_accordion=gr.Accordion(label="⚙️ Parameters", open=False),
|
| 130 |
+
additional_inputs=[
|
| 131 |
+
gr.Textbox("Perform the task to the best of your ability.", label="System prompt"),
|
| 132 |
+
gr.Slider(0, 1, 0.8, label="Temperature"),
|
| 133 |
+
gr.Slider(128, 4096, 512, label="Max new tokens"),
|
| 134 |
+
gr.Slider(1, 80, 40, label="Top K sampling"),
|
| 135 |
+
gr.Slider(0, 2, 1.1, label="Repetition penalty"),
|
| 136 |
+
gr.Slider(0, 1, 0.95, label="Top P sampling"),
|
| 137 |
+
],
|
| 138 |
+
theme=gr.themes.Soft(primary_hue=COLOR).set(
|
| 139 |
+
background_fill_primary_dark="#020417",
|
| 140 |
+
background_fill_secondary_dark="#020417",
|
| 141 |
+
body_background_fill_dark="#020417",
|
| 142 |
+
block_background_fill_dark="#020417",
|
| 143 |
+
block_border_width="1px",
|
| 144 |
+
block_title_background_fill_dark="#15172c",
|
| 145 |
+
input_background_fill_dark="#15172c",
|
| 146 |
+
button_secondary_background_fill_dark="#15172c",
|
| 147 |
+
border_color_accent_dark="#15172c",
|
| 148 |
+
border_color_primary_dark="#15172c",
|
| 149 |
+
color_accent_soft_dark="#10132c",
|
| 150 |
+
code_background_fill_dark="#15172c",
|
| 151 |
+
),
|
| 152 |
+
css=css,
|
| 153 |
+
retry_btn="Retry",
|
| 154 |
+
undo_btn="Undo",
|
| 155 |
+
clear_btn="Clear",
|
| 156 |
+
submit_btn="Send",
|
| 157 |
+
chatbot=gr.Chatbot(
|
| 158 |
+
scale=1,
|
| 159 |
+
show_copy_button=True
|
| 160 |
+
)
|
| 161 |
+
).queue().launch()
|