Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -103,20 +103,18 @@ def predict(user_input, history, access_granted):
|
|
| 103 |
return history, ""
|
| 104 |
|
| 105 |
with gr.Blocks(theme, css="""
|
| 106 |
-
#chatbot {
|
| 107 |
-
.gradio-container { height:
|
| 108 |
#component-0 { height: 100%; }
|
| 109 |
-
#component-3 { height: calc(100% - 250px); }
|
| 110 |
footer { display: none !important; }
|
|
|
|
|
|
|
|
|
|
| 111 |
#submit-btn { margin-top: 10px; }
|
| 112 |
#code_submit {
|
| 113 |
height: 50px !important;
|
| 114 |
font-size: 1.2em !important;
|
| 115 |
}
|
| 116 |
-
/* Add these new rules here */
|
| 117 |
-
.message-wrap { max-height: 300px !important; overflow-y: auto !important; }
|
| 118 |
-
.chat-wrap { max-height: 400px !important; overflow-y: auto !important; }
|
| 119 |
-
.gradio-container { height: auto !important; min-height: 0 !important; }
|
| 120 |
@media (max-width: 600px) {
|
| 121 |
#code_submit {
|
| 122 |
height: 60px !important;
|
|
@@ -131,30 +129,20 @@ with gr.Blocks(theme, css="""
|
|
| 131 |
access_granted = gr.State(False)
|
| 132 |
|
| 133 |
with gr.Tab("Access"):
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
code_message = gr.Label(label="Status", elem_id="code_message")
|
| 139 |
|
| 140 |
with gr.Tab("Chat"):
|
| 141 |
-
chatbot = gr.Chatbot(label="Conversation", height=340)
|
| 142 |
with gr.Row():
|
| 143 |
msg = gr.Textbox(
|
| 144 |
label=f"Chat with {coach_name_short}",
|
| 145 |
placeholder="Type your message here... (MAX: 1000 characters)",
|
| 146 |
interactive=False
|
| 147 |
)
|
| 148 |
-
submit = gr.Button("Submit
|
| 149 |
-
|
| 150 |
-
# Make sure to add this part outside of the with gr.Tab("Chat") block,
|
| 151 |
-
# where you define other event handlers:
|
| 152 |
-
submit.click(
|
| 153 |
-
predict,
|
| 154 |
-
inputs=[msg, chatbot, access_granted],
|
| 155 |
-
outputs=[chatbot, msg],
|
| 156 |
-
scroll_to_output=True
|
| 157 |
-
)
|
| 158 |
|
| 159 |
def submit_code(code, access_granted):
|
| 160 |
success, _, _, message = verify_code(code, access_granted)
|
|
|
|
| 103 |
return history, ""
|
| 104 |
|
| 105 |
with gr.Blocks(theme, css="""
|
| 106 |
+
#chatbot { height: calc(100% - 100px) !important; overflow-y: auto; }
|
| 107 |
+
.gradio-container { height: 100vh; max-width: 100% !important; padding: 0 !important; }
|
| 108 |
#component-0 { height: 100%; }
|
|
|
|
| 109 |
footer { display: none !important; }
|
| 110 |
+
.message-wrap { overflow-y: auto !important; max-height: none !important; }
|
| 111 |
+
.chat-wrap { max-height: none !important; }
|
| 112 |
+
.scroll-hide { max-height: none !important; }
|
| 113 |
#submit-btn { margin-top: 10px; }
|
| 114 |
#code_submit {
|
| 115 |
height: 50px !important;
|
| 116 |
font-size: 1.2em !important;
|
| 117 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
@media (max-width: 600px) {
|
| 119 |
#code_submit {
|
| 120 |
height: 60px !important;
|
|
|
|
| 129 |
access_granted = gr.State(False)
|
| 130 |
|
| 131 |
with gr.Tab("Access"):
|
| 132 |
+
gr.Markdown("Enter the Access Code displayed in the upper-left corner.")
|
| 133 |
+
code_input = gr.Textbox(label="Access Code", type="text", placeholder="Enter CODE here...")
|
| 134 |
+
code_submit = gr.Button("Submit Code", elem_id="code_submit")
|
| 135 |
+
code_message = gr.Label(label="Status", elem_id="code_message")
|
|
|
|
| 136 |
|
| 137 |
with gr.Tab("Chat"):
|
| 138 |
+
chatbot = gr.Chatbot(label="Conversation", elem_id="chatbot", height=340)
|
| 139 |
with gr.Row():
|
| 140 |
msg = gr.Textbox(
|
| 141 |
label=f"Chat with {coach_name_short}",
|
| 142 |
placeholder="Type your message here... (MAX: 1000 characters)",
|
| 143 |
interactive=False
|
| 144 |
)
|
| 145 |
+
submit = gr.Button("Submit", interactive=False, scale=0.15)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 146 |
|
| 147 |
def submit_code(code, access_granted):
|
| 148 |
success, _, _, message = verify_code(code, access_granted)
|