Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -102,30 +102,56 @@ def predict(user_input, history, access_granted):
|
|
102 |
history.append((user_input, message_content))
|
103 |
return history, ""
|
104 |
|
105 |
-
css
|
106 |
-
#
|
107 |
-
|
108 |
-
|
109 |
-
}
|
110 |
-
footer {
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
access_granted = gr.State(False)
|
117 |
|
118 |
with gr.Tab("Access"):
|
119 |
gr.Markdown("Enter the Access Code displayed in the upper-left corner.")
|
120 |
code_input = gr.Textbox(label="Access Code", type="text", placeholder="Enter CODE here...")
|
121 |
-
code_submit = gr.Button("Submit Code")
|
122 |
-
code_message = gr.Markdown()
|
123 |
|
124 |
with gr.Tab("Chat"):
|
125 |
chatbot = gr.Chatbot(label="Conversation")
|
126 |
msg = gr.Textbox(
|
127 |
label=f"Chat with {coach_name_short}",
|
128 |
-
max_lines=10,
|
129 |
placeholder="Type your message here... (MAX: 1000 characters)",
|
130 |
interactive=False
|
131 |
)
|
|
|
102 |
history.append((user_input, message_content))
|
103 |
return history, ""
|
104 |
|
105 |
+
with gr.Blocks(theme, css="""
|
106 |
+
#chatbot { flex-grow: 1; height: 460px; overflow-y: auto; }
|
107 |
+
.gradio-container { height: 680px; max-width: 100% !important; padding: 0 !important; }
|
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 |
+
#code_message {
|
117 |
+
font-size: 1.4em !important;
|
118 |
+
font-weight: bold !important;
|
119 |
+
padding: 15px !important;
|
120 |
+
margin-top: 15px !important;
|
121 |
+
border-radius: 5px !important;
|
122 |
+
text-align: center !important;
|
123 |
+
}
|
124 |
+
#code_message.error { color: #d32f2f !important; background-color: #ffcdd2 !important; }
|
125 |
+
#code_message.success { color: #388e3c !important; background-color: #c8e6c9 !important; }
|
126 |
+
|
127 |
+
/* Add these new rules here */
|
128 |
+
.message-wrap { max-height: 300px !important; overflow-y: auto !important; }
|
129 |
+
.chat-wrap { max-height: 400px !important; overflow-y: auto !important; }
|
130 |
+
.gradio-container { height: auto !important; min-height: 0 !important; }
|
131 |
+
|
132 |
+
@media (max-width: 600px) {
|
133 |
+
#code_submit {
|
134 |
+
height: 60px !important;
|
135 |
+
font-size: 1.3em !important;
|
136 |
+
}
|
137 |
+
#code_message {
|
138 |
+
font-size: 1.2em !important;
|
139 |
+
padding: 10px !important;
|
140 |
+
}
|
141 |
+
}
|
142 |
+
""") as demo:
|
143 |
access_granted = gr.State(False)
|
144 |
|
145 |
with gr.Tab("Access"):
|
146 |
gr.Markdown("Enter the Access Code displayed in the upper-left corner.")
|
147 |
code_input = gr.Textbox(label="Access Code", type="text", placeholder="Enter CODE here...")
|
148 |
+
code_submit = gr.Button("Submit Code", elem_id="code_submit")
|
149 |
+
code_message = gr.Markdown(elem_id="code_message")
|
150 |
|
151 |
with gr.Tab("Chat"):
|
152 |
chatbot = gr.Chatbot(label="Conversation")
|
153 |
msg = gr.Textbox(
|
154 |
label=f"Chat with {coach_name_short}",
|
|
|
155 |
placeholder="Type your message here... (MAX: 1000 characters)",
|
156 |
interactive=False
|
157 |
)
|