Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -119,33 +119,84 @@ def handle_audio(audio_file, chat_history, user_profile):
|
|
| 119 |
return chat_history
|
| 120 |
return respond(transcribed, chat_history, user_profile)
|
| 121 |
|
| 122 |
-
#
|
| 123 |
-
with gr.Blocks(css="""
|
| 124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
|
| 126 |
user_profile = gr.State({"interview_type": "", "field": "", "interview_in_progress": False})
|
| 127 |
chat_history = gr.State([])
|
| 128 |
|
| 129 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
with gr.Row():
|
| 131 |
-
with gr.Column():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
btn1 = gr.Button("Technical")
|
| 133 |
btn2 = gr.Button("Competency-Based Interview")
|
| 134 |
btn3 = gr.Button("Case")
|
| 135 |
-
|
|
|
|
|
|
|
| 136 |
|
| 137 |
btn1.click(set_type, inputs=[gr.Textbox(value="Technical", visible=False), user_profile], outputs=[type_output, user_profile])
|
| 138 |
btn2.click(set_type, inputs=[gr.Textbox(value="Competency-Based Interview", visible=False), user_profile], outputs=[type_output, user_profile])
|
| 139 |
btn3.click(set_type, inputs=[gr.Textbox(value="Case", visible=False), user_profile], outputs=[type_output, user_profile])
|
| 140 |
|
| 141 |
-
# Step 2
|
|
|
|
| 142 |
background = gr.Textbox(label="Your background and field/goal")
|
| 143 |
background_btn = gr.Button("Submit")
|
| 144 |
background_output = gr.Textbox(label="Bot response", interactive=False)
|
| 145 |
background_btn.click(save_background, inputs=[background, user_profile], outputs=[background_output, user_profile])
|
| 146 |
|
| 147 |
-
# Step 3
|
| 148 |
-
gr.Markdown("### Choose Chat Mode")
|
| 149 |
with gr.Tabs():
|
| 150 |
with gr.Tab("Text Mode"):
|
| 151 |
chatbot_text = gr.Chatbot(label="Interview Chat (Text Mode)", type="messages")
|
|
|
|
| 119 |
return chat_history
|
| 120 |
return respond(transcribed, chat_history, user_profile)
|
| 121 |
|
| 122 |
+
# Full UI
|
| 123 |
+
with gr.Blocks(css="""
|
| 124 |
+
body { background-color: #161b24; font-family: 'Nato', sans-serif !important; }
|
| 125 |
+
h1 { text-align: center; color: #2c3e50; }
|
| 126 |
+
img { display: block; margin: auto; width: 100px; border-radius: 20px; }
|
| 127 |
+
button {
|
| 128 |
+
font-size: 16px;
|
| 129 |
+
padding: 10px 20px;
|
| 130 |
+
border-radius: 10px;
|
| 131 |
+
border: 2px solid rgba(124, 248, 255, 0.4);
|
| 132 |
+
background-color: rgba(124, 248, 255, 0.4);
|
| 133 |
+
color: #fafdff;
|
| 134 |
+
transition: all 0.2s ease;
|
| 135 |
+
}
|
| 136 |
+
button:hover {
|
| 137 |
+
background-color: #49888f;
|
| 138 |
+
border-color: #7cf8ff;
|
| 139 |
+
transform: scale(1.05);
|
| 140 |
+
}
|
| 141 |
+
.gr-chatbot { background-color: white; border-radius: 15px; padding: 20px; }
|
| 142 |
+
""") as demo:
|
| 143 |
+
|
| 144 |
+
gr.Markdown("""
|
| 145 |
+
<div style='width: 100%; text-align: center;'>
|
| 146 |
+
<img src="https://cdn-uploads.huggingface.co/production/uploads/6841b10b397a67a7c7a39b89/MTR_dMHte-RCIbyujLW83.png" style="width: 100%; height: auto; object-fit: contain;">
|
| 147 |
+
</div>
|
| 148 |
+
""")
|
| 149 |
|
| 150 |
user_profile = gr.State({"interview_type": "", "field": "", "interview_in_progress": False})
|
| 151 |
chat_history = gr.State([])
|
| 152 |
|
| 153 |
+
gr.Markdown("""<div style='
|
| 154 |
+
font-family: 'Lato', sans-serif;
|
| 155 |
+
text-align: center;
|
| 156 |
+
padding: 30px;
|
| 157 |
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
| 158 |
+
margin-bottom: 20px;
|
| 159 |
+
'>
|
| 160 |
+
<h1 style='font-size: 89.5px; color: #fafdff;'>Welcome to <b><span style='color: #7cf8ff;'>Intervu</span></b></h1>
|
| 161 |
+
<p style='font-size: 22.1px; color: #fafdff; margin-top: 30px; text-align: center; margin-bottom: 30px;'>Before you begin, complete Step 1 to select your interview type and Step 2 to enter your background. Practice is available through text, speech, or webcam.</p>
|
| 162 |
+
</div>
|
| 163 |
+
""")
|
| 164 |
+
|
| 165 |
+
# Step 1: Interview Type
|
| 166 |
with gr.Row():
|
| 167 |
+
with gr.Column(scale=2):
|
| 168 |
+
gr.Markdown("""
|
| 169 |
+
<div style="
|
| 170 |
+
background: rgba(255, 255, 255, 0.1);
|
| 171 |
+
padding: 20px;
|
| 172 |
+
border-radius: 15px;
|
| 173 |
+
backdrop-filter: blur(5px);
|
| 174 |
+
box-shadow: 0 4px 10px rgba(0,0,0,0.2);
|
| 175 |
+
">
|
| 176 |
+
<h3>Step 1: Choose Interview Type</h3>
|
| 177 |
+
<p>Select the type of interview you want to practice.</p>
|
| 178 |
+
</div>
|
| 179 |
+
""")
|
| 180 |
btn1 = gr.Button("Technical")
|
| 181 |
btn2 = gr.Button("Competency-Based Interview")
|
| 182 |
btn3 = gr.Button("Case")
|
| 183 |
+
|
| 184 |
+
with gr.Column(scale=2):
|
| 185 |
+
type_output = gr.Textbox(label="Bot Response", interactive=False)
|
| 186 |
|
| 187 |
btn1.click(set_type, inputs=[gr.Textbox(value="Technical", visible=False), user_profile], outputs=[type_output, user_profile])
|
| 188 |
btn2.click(set_type, inputs=[gr.Textbox(value="Competency-Based Interview", visible=False), user_profile], outputs=[type_output, user_profile])
|
| 189 |
btn3.click(set_type, inputs=[gr.Textbox(value="Case", visible=False), user_profile], outputs=[type_output, user_profile])
|
| 190 |
|
| 191 |
+
# Step 2: Background
|
| 192 |
+
gr.Markdown("### Step 2: Enter Your Background")
|
| 193 |
background = gr.Textbox(label="Your background and field/goal")
|
| 194 |
background_btn = gr.Button("Submit")
|
| 195 |
background_output = gr.Textbox(label="Bot response", interactive=False)
|
| 196 |
background_btn.click(save_background, inputs=[background, user_profile], outputs=[background_output, user_profile])
|
| 197 |
|
| 198 |
+
# Step 3: Chat Mode Tabs
|
| 199 |
+
gr.Markdown("### Step 3: Choose Chat Mode")
|
| 200 |
with gr.Tabs():
|
| 201 |
with gr.Tab("Text Mode"):
|
| 202 |
chatbot_text = gr.Chatbot(label="Interview Chat (Text Mode)", type="messages")
|