Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -46,7 +46,6 @@ class AIAgent:
|
|
| 46 |
agent_prompt = f"""
|
| 47 |
As an elite expert developer, my name is {self.name}. I possess a comprehensive understanding of the following areas:
|
| 48 |
{skills_str}
|
| 49 |
-
|
| 50 |
I am confident that I can leverage my expertise to assist you in developing and deploying cutting-edge web applications. Please feel free to ask any questions or present any challenges you may encounter.
|
| 51 |
"""
|
| 52 |
return agent_prompt
|
|
@@ -81,7 +80,7 @@ I am confident that I can leverage my expertise to assist you in developing and
|
|
| 81 |
return self._hf_api.whoami(token=hf_token) is not None
|
| 82 |
|
| 83 |
def process_input(input_text: str) -> str:
|
| 84 |
-
chatbot = pipeline("text-generation", model="microsoft/DialoGPT-medium", tokenizer="microsoft/DialoGPT-medium")
|
| 85 |
response = chatbot(input_text, max_length=50, num_return_sequences=1)[0]['generated_text']
|
| 86 |
return response
|
| 87 |
|
|
@@ -132,7 +131,7 @@ def display_ai_guide_chat(chat_history: List[tuple[str, str]]):
|
|
| 132 |
st.markdown("</div>", unsafe_allow_html=True)
|
| 133 |
|
| 134 |
# Load the CodeGPT model for code completion
|
| 135 |
-
code_generator = pipeline("text-generation", model="microsoft/CodeGPT-small-py", tokenizer="microsoft/CodeGPT-small-py")
|
| 136 |
|
| 137 |
def analyze_code(code: str) -> List[str]:
|
| 138 |
hints = []
|
|
@@ -291,17 +290,14 @@ if __name__ == "__main__":
|
|
| 291 |
margin: 0;
|
| 292 |
padding: 0;
|
| 293 |
}
|
| 294 |
-
|
| 295 |
h1, h2, h3, h4, h5, h6 {
|
| 296 |
color: #333;
|
| 297 |
}
|
| 298 |
-
|
| 299 |
.container {
|
| 300 |
width: 90%;
|
| 301 |
margin: 0 auto;
|
| 302 |
padding: 20px;
|
| 303 |
}
|
| 304 |
-
|
| 305 |
/* Navigation Sidebar */
|
| 306 |
.sidebar {
|
| 307 |
background-color: #2c3e50;
|
|
@@ -314,25 +310,21 @@ if __name__ == "__main__":
|
|
| 314 |
width: 250px;
|
| 315 |
overflow-y: auto;
|
| 316 |
}
|
| 317 |
-
|
| 318 |
.sidebar a {
|
| 319 |
color: #ecf0f1;
|
| 320 |
text-decoration: none;
|
| 321 |
display: block;
|
| 322 |
padding: 10px 0;
|
| 323 |
}
|
| 324 |
-
|
| 325 |
.sidebar a:hover {
|
| 326 |
background-color: #34495e;
|
| 327 |
border-radius: 5px;
|
| 328 |
}
|
| 329 |
-
|
| 330 |
/* Main Content */
|
| 331 |
.main-content {
|
| 332 |
margin-left: 270px;
|
| 333 |
padding: 20px;
|
| 334 |
}
|
| 335 |
-
|
| 336 |
/* Buttons */
|
| 337 |
button {
|
| 338 |
background-color: #3498db;
|
|
@@ -343,11 +335,9 @@ if __name__ == "__main__":
|
|
| 343 |
cursor: pointer;
|
| 344 |
font-size: 16px;
|
| 345 |
}
|
| 346 |
-
|
| 347 |
button:hover {
|
| 348 |
background-color: #2980b9;
|
| 349 |
}
|
| 350 |
-
|
| 351 |
/* Text Areas and Inputs */
|
| 352 |
textarea, input[type="text"] {
|
| 353 |
width: 100%;
|
|
@@ -357,12 +347,10 @@ if __name__ == "__main__":
|
|
| 357 |
border-radius: 5px;
|
| 358 |
box-sizing: border-box;
|
| 359 |
}
|
| 360 |
-
|
| 361 |
textarea:focus, input[type="text"]:focus {
|
| 362 |
border-color: #3498db;
|
| 363 |
outline: none;
|
| 364 |
}
|
| 365 |
-
|
| 366 |
/* Terminal Output */
|
| 367 |
.code-output {
|
| 368 |
background-color: #1e1e1e;
|
|
@@ -371,7 +359,6 @@ if __name__ == "__main__":
|
|
| 371 |
border-radius: 5px;
|
| 372 |
font-family: 'Courier New', Courier, monospace;
|
| 373 |
}
|
| 374 |
-
|
| 375 |
/* Chat History */
|
| 376 |
.chat-history {
|
| 377 |
background-color: #ecf0f1;
|
|
@@ -380,21 +367,17 @@ if __name__ == "__main__":
|
|
| 380 |
max-height: 300px;
|
| 381 |
overflow-y: auto;
|
| 382 |
}
|
| 383 |
-
|
| 384 |
.chat-message {
|
| 385 |
margin-bottom: 10px;
|
| 386 |
}
|
| 387 |
-
|
| 388 |
.chat-message.user {
|
| 389 |
text-align: right;
|
| 390 |
color: #3498db;
|
| 391 |
}
|
| 392 |
-
|
| 393 |
.chat-message.agent {
|
| 394 |
text-align: left;
|
| 395 |
color: #e74c3c;
|
| 396 |
}
|
| 397 |
-
|
| 398 |
/* Project Management */
|
| 399 |
.project-list {
|
| 400 |
background-color: #ecf0f1;
|
|
@@ -403,16 +386,13 @@ if __name__ == "__main__":
|
|
| 403 |
max-height: 300px;
|
| 404 |
overflow-y: auto;
|
| 405 |
}
|
| 406 |
-
|
| 407 |
.project-item {
|
| 408 |
margin-bottom: 10px;
|
| 409 |
}
|
| 410 |
-
|
| 411 |
.project-item a {
|
| 412 |
color: #3498db;
|
| 413 |
text-decoration: none;
|
| 414 |
}
|
| 415 |
-
|
| 416 |
.project-item a:hover {
|
| 417 |
text-decoration: underline;
|
| 418 |
}
|
|
|
|
| 46 |
agent_prompt = f"""
|
| 47 |
As an elite expert developer, my name is {self.name}. I possess a comprehensive understanding of the following areas:
|
| 48 |
{skills_str}
|
|
|
|
| 49 |
I am confident that I can leverage my expertise to assist you in developing and deploying cutting-edge web applications. Please feel free to ask any questions or present any challenges you may encounter.
|
| 50 |
"""
|
| 51 |
return agent_prompt
|
|
|
|
| 80 |
return self._hf_api.whoami(token=hf_token) is not None
|
| 81 |
|
| 82 |
def process_input(input_text: str) -> str:
|
| 83 |
+
chatbot = pipeline("text-generation", model="microsoft/DialoGPT-medium", tokenizer="microsoft/DialoGPT-medium", clean_up_tokenization_spaces=True)
|
| 84 |
response = chatbot(input_text, max_length=50, num_return_sequences=1)[0]['generated_text']
|
| 85 |
return response
|
| 86 |
|
|
|
|
| 131 |
st.markdown("</div>", unsafe_allow_html=True)
|
| 132 |
|
| 133 |
# Load the CodeGPT model for code completion
|
| 134 |
+
code_generator = pipeline("text-generation", model="microsoft/CodeGPT-small-py", tokenizer="microsoft/CodeGPT-small-py", clean_up_tokenization_spaces=True)
|
| 135 |
|
| 136 |
def analyze_code(code: str) -> List[str]:
|
| 137 |
hints = []
|
|
|
|
| 290 |
margin: 0;
|
| 291 |
padding: 0;
|
| 292 |
}
|
|
|
|
| 293 |
h1, h2, h3, h4, h5, h6 {
|
| 294 |
color: #333;
|
| 295 |
}
|
|
|
|
| 296 |
.container {
|
| 297 |
width: 90%;
|
| 298 |
margin: 0 auto;
|
| 299 |
padding: 20px;
|
| 300 |
}
|
|
|
|
| 301 |
/* Navigation Sidebar */
|
| 302 |
.sidebar {
|
| 303 |
background-color: #2c3e50;
|
|
|
|
| 310 |
width: 250px;
|
| 311 |
overflow-y: auto;
|
| 312 |
}
|
|
|
|
| 313 |
.sidebar a {
|
| 314 |
color: #ecf0f1;
|
| 315 |
text-decoration: none;
|
| 316 |
display: block;
|
| 317 |
padding: 10px 0;
|
| 318 |
}
|
|
|
|
| 319 |
.sidebar a:hover {
|
| 320 |
background-color: #34495e;
|
| 321 |
border-radius: 5px;
|
| 322 |
}
|
|
|
|
| 323 |
/* Main Content */
|
| 324 |
.main-content {
|
| 325 |
margin-left: 270px;
|
| 326 |
padding: 20px;
|
| 327 |
}
|
|
|
|
| 328 |
/* Buttons */
|
| 329 |
button {
|
| 330 |
background-color: #3498db;
|
|
|
|
| 335 |
cursor: pointer;
|
| 336 |
font-size: 16px;
|
| 337 |
}
|
|
|
|
| 338 |
button:hover {
|
| 339 |
background-color: #2980b9;
|
| 340 |
}
|
|
|
|
| 341 |
/* Text Areas and Inputs */
|
| 342 |
textarea, input[type="text"] {
|
| 343 |
width: 100%;
|
|
|
|
| 347 |
border-radius: 5px;
|
| 348 |
box-sizing: border-box;
|
| 349 |
}
|
|
|
|
| 350 |
textarea:focus, input[type="text"]:focus {
|
| 351 |
border-color: #3498db;
|
| 352 |
outline: none;
|
| 353 |
}
|
|
|
|
| 354 |
/* Terminal Output */
|
| 355 |
.code-output {
|
| 356 |
background-color: #1e1e1e;
|
|
|
|
| 359 |
border-radius: 5px;
|
| 360 |
font-family: 'Courier New', Courier, monospace;
|
| 361 |
}
|
|
|
|
| 362 |
/* Chat History */
|
| 363 |
.chat-history {
|
| 364 |
background-color: #ecf0f1;
|
|
|
|
| 367 |
max-height: 300px;
|
| 368 |
overflow-y: auto;
|
| 369 |
}
|
|
|
|
| 370 |
.chat-message {
|
| 371 |
margin-bottom: 10px;
|
| 372 |
}
|
|
|
|
| 373 |
.chat-message.user {
|
| 374 |
text-align: right;
|
| 375 |
color: #3498db;
|
| 376 |
}
|
|
|
|
| 377 |
.chat-message.agent {
|
| 378 |
text-align: left;
|
| 379 |
color: #e74c3c;
|
| 380 |
}
|
|
|
|
| 381 |
/* Project Management */
|
| 382 |
.project-list {
|
| 383 |
background-color: #ecf0f1;
|
|
|
|
| 386 |
max-height: 300px;
|
| 387 |
overflow-y: auto;
|
| 388 |
}
|
|
|
|
| 389 |
.project-item {
|
| 390 |
margin-bottom: 10px;
|
| 391 |
}
|
|
|
|
| 392 |
.project-item a {
|
| 393 |
color: #3498db;
|
| 394 |
text-decoration: none;
|
| 395 |
}
|
|
|
|
| 396 |
.project-item a:hover {
|
| 397 |
text-decoration: underline;
|
| 398 |
}
|