Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -98,41 +98,93 @@ Will not describe your needs to ChatGPT?You Use [ChatGPT Shortcut](https://new
|
|
| 98 |
|
| 99 |
</div>
|
| 100 |
"""
|
| 101 |
-
|
| 102 |
with gr.Blocks() as demo:
|
| 103 |
gr.HTML(title)
|
| 104 |
chatbot = gr.Chatbot().style(color_map=("#A238FF", "#A238FF"))
|
|
|
|
| 105 |
context = gr.State([])
|
|
|
|
| 106 |
systemPrompt = gr.State(update_system(initial_prompt))
|
| 107 |
-
|
| 108 |
with gr.Row():
|
| 109 |
with gr.Column(scale=12):
|
| 110 |
txt = gr.Textbox(show_label=False, placeholder="Please enter any of your needs here").style(container=False)
|
| 111 |
with gr.Column(min_width=50, scale=1):
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
|
|
|
| 122 |
|
| 123 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
|
| 125 |
txt.submit(predict, [chatbot, txt, systemPrompt, context], [chatbot, context], show_progress=True)
|
| 126 |
txt.submit(lambda :"", None, txt)
|
|
|
|
| 127 |
submitBtn.click(predict, [chatbot, txt, systemPrompt, context], [chatbot, context], show_progress=True)
|
| 128 |
submitBtn.click(lambda :"", None, txt)
|
|
|
|
| 129 |
emptyBtn.click(reset_state, outputs=[chatbot, context])
|
| 130 |
-
#newSystemPrompt.submit(update_system, newSystemPrompt, systemPrompt)
|
| 131 |
-
#newSystemPrompt.submit(lambda x: x, newSystemPrompt, systemPromptDisplay)
|
| 132 |
-
#newSystemPrompt.submit(lambda :"", None, newSystemPrompt)
|
| 133 |
retryBtn.click(retry, [chatbot, systemPrompt, context], [chatbot, context], show_progress=True)
|
| 134 |
delLastBtn.click(delete_last_conversation, [chatbot, context], [chatbot, context], show_progress=True)
|
| 135 |
-
|
| 136 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
|
| 138 |
demo.launch()
|
|
|
|
| 98 |
|
| 99 |
</div>
|
| 100 |
"""
|
|
|
|
| 101 |
with gr.Blocks() as demo:
|
| 102 |
gr.HTML(title)
|
| 103 |
chatbot = gr.Chatbot().style(color_map=("#A238FF", "#A238FF"))
|
| 104 |
+
|
| 105 |
context = gr.State([])
|
| 106 |
+
|
| 107 |
systemPrompt = gr.State(update_system(initial_prompt))
|
| 108 |
+
|
| 109 |
with gr.Row():
|
| 110 |
with gr.Column(scale=12):
|
| 111 |
txt = gr.Textbox(show_label=False, placeholder="Please enter any of your needs here").style(container=False)
|
| 112 |
with gr.Column(min_width=50, scale=1):
|
| 113 |
+
submitBtn = gr.Button("🚀 Submit").style(
|
| 114 |
+
css={
|
| 115 |
+
"background-color": "#A238FF",
|
| 116 |
+
"border-radius": "8px",
|
| 117 |
+
"padding": "8px",
|
| 118 |
+
"color": "white",
|
| 119 |
+
"font-weight": "bold",
|
| 120 |
+
"font-size": "1em",
|
| 121 |
+
"cursor": "pointer",
|
| 122 |
+
}
|
| 123 |
+
)
|
| 124 |
|
| 125 |
+
with gr.Row():
|
| 126 |
+
emptyBtn = gr.Button("🧹 New conversation").style(
|
| 127 |
+
css={
|
| 128 |
+
"background-color": "#E0E0E0",
|
| 129 |
+
"border-radius": "8px",
|
| 130 |
+
"padding": "8px",
|
| 131 |
+
"color": "black",
|
| 132 |
+
"font-weight": "bold",
|
| 133 |
+
"font-size": "1em",
|
| 134 |
+
"cursor": "pointer",
|
| 135 |
+
}
|
| 136 |
+
)
|
| 137 |
+
retryBtn = gr.Button("🔄 Resubmit").style(
|
| 138 |
+
css={
|
| 139 |
+
"background-color": "#E0E0E0",
|
| 140 |
+
"border-radius": "8px",
|
| 141 |
+
"padding": "8px",
|
| 142 |
+
"color": "black",
|
| 143 |
+
"font-weight": "bold",
|
| 144 |
+
"font-size": "1em",
|
| 145 |
+
"cursor": "pointer",
|
| 146 |
+
}
|
| 147 |
+
)
|
| 148 |
+
delLastBtn = gr.Button("🗑️ Delete conversation").style(
|
| 149 |
+
css={
|
| 150 |
+
"background-color": "#E0E0E0",
|
| 151 |
+
"border-radius": "8px",
|
| 152 |
+
"padding": "8px",
|
| 153 |
+
"color": "black",
|
| 154 |
+
"font-weight": "bold",
|
| 155 |
+
"font-size": "1em",
|
| 156 |
+
"cursor": "pointer",
|
| 157 |
+
}
|
| 158 |
+
)
|
| 159 |
|
| 160 |
txt.submit(predict, [chatbot, txt, systemPrompt, context], [chatbot, context], show_progress=True)
|
| 161 |
txt.submit(lambda :"", None, txt)
|
| 162 |
+
|
| 163 |
submitBtn.click(predict, [chatbot, txt, systemPrompt, context], [chatbot, context], show_progress=True)
|
| 164 |
submitBtn.click(lambda :"", None, txt)
|
| 165 |
+
|
| 166 |
emptyBtn.click(reset_state, outputs=[chatbot, context])
|
|
|
|
|
|
|
|
|
|
| 167 |
retryBtn.click(retry, [chatbot, systemPrompt, context], [chatbot, context], show_progress=True)
|
| 168 |
delLastBtn.click(delete_last_conversation, [chatbot, context], [chatbot, context], show_progress=True)
|
| 169 |
+
|
| 170 |
+
demo.style(
|
| 171 |
+
css={
|
| 172 |
+
"background-color": "#F5F5F5",
|
| 173 |
+
"font-family": "sans-serif",
|
| 174 |
+
"padding": "20px",
|
| 175 |
+
"border-radius": "8px",
|
| 176 |
+
"box-shadow": "0px 2px 6px rgba(0,0,0,0.3)",
|
| 177 |
+
}
|
| 178 |
+
)
|
| 179 |
+
|
| 180 |
+
demo.children[0].style(
|
| 181 |
+
css={
|
| 182 |
+
"text-align": "center",
|
| 183 |
+
"font-size": "1.5em",
|
| 184 |
+
"margin-bottom": "20px",
|
| 185 |
+
}
|
| 186 |
+
)
|
| 187 |
+
|
| 188 |
+
gr.set_gradio_chart_theme(theme="light")
|
| 189 |
|
| 190 |
demo.launch()
|