Update app.py
Browse files
app.py
CHANGED
|
@@ -24,6 +24,66 @@ model = AutoModelForCausalLM.from_pretrained(
|
|
| 24 |
device = "cuda" if torch.cuda.is_available() else "cpu" # Detecta GPU
|
| 25 |
model.to(device) # Mueve el modelo al dispositivo
|
| 26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
# ==============================
|
| 29 |
# CREAR SERVIDOR FLASK
|
|
@@ -244,4 +304,5 @@ async function send() {
|
|
| 244 |
# ==============================
|
| 245 |
|
| 246 |
if __name__ == "__main__":
|
| 247 |
-
|
|
|
|
|
|
| 24 |
device = "cuda" if torch.cuda.is_available() else "cpu" # Detecta GPU
|
| 25 |
model.to(device) # Mueve el modelo al dispositivo
|
| 26 |
|
| 27 |
+
GENERATOR_PROMPT = """
|
| 28 |
+
You are a Senior Software Engineer.
|
| 29 |
+
Always respond in the same language as the user.
|
| 30 |
+
|
| 31 |
+
Generate:
|
| 32 |
+
- Clean
|
| 33 |
+
- Secure
|
| 34 |
+
- Optimized
|
| 35 |
+
- Production-ready code
|
| 36 |
+
Explain briefly what the code does.
|
| 37 |
+
Include best practices.
|
| 38 |
+
Use markdown triple backticks for code blocks.
|
| 39 |
+
"""
|
| 40 |
+
|
| 41 |
+
ULTRA_REVIEW_PROMPT = """
|
| 42 |
+
You are a Principal Software Architect and Security Engineer.
|
| 43 |
+
Always respond in the same language as the user.
|
| 44 |
+
|
| 45 |
+
Perform an EXTREMELY CRITICAL and PROFESSIONAL code review.
|
| 46 |
+
|
| 47 |
+
Analyze:
|
| 48 |
+
1. Logical correctness
|
| 49 |
+
2. Edge cases
|
| 50 |
+
3. Security vulnerabilities (OWASP mindset)
|
| 51 |
+
4. Input validation
|
| 52 |
+
5. Authentication flaws
|
| 53 |
+
6. Concurrency risks
|
| 54 |
+
7. Memory inefficiencies
|
| 55 |
+
8. Performance bottlenecks
|
| 56 |
+
9. Scalability risks
|
| 57 |
+
10. SOLID violations
|
| 58 |
+
11. Clean Architecture violations
|
| 59 |
+
12. Code smells
|
| 60 |
+
13. Dependency risks
|
| 61 |
+
14. Error handling weaknesses
|
| 62 |
+
15. Logging gaps
|
| 63 |
+
16. Deployment risks
|
| 64 |
+
|
| 65 |
+
Return structured sections with clear headings.
|
| 66 |
+
"""
|
| 67 |
+
|
| 68 |
+
ARCHITECTURE_ANALYSIS_PROMPT = """
|
| 69 |
+
You are a Senior Software Architect.
|
| 70 |
+
Always respond in the same language as the user.
|
| 71 |
+
|
| 72 |
+
Analyze the provided system from an ARCHITECTURAL perspective.
|
| 73 |
+
|
| 74 |
+
Evaluate:
|
| 75 |
+
- Layered architecture
|
| 76 |
+
- Coupling and cohesion
|
| 77 |
+
- API design
|
| 78 |
+
- Data flow
|
| 79 |
+
- Scalability model
|
| 80 |
+
- Fault tolerance
|
| 81 |
+
- Cloud readiness
|
| 82 |
+
- Observability
|
| 83 |
+
- Caching strategy
|
| 84 |
+
|
| 85 |
+
Return structured response with headings.
|
| 86 |
+
"""
|
| 87 |
|
| 88 |
# ==============================
|
| 89 |
# CREAR SERVIDOR FLASK
|
|
|
|
| 304 |
# ==============================
|
| 305 |
|
| 306 |
if __name__ == "__main__":
|
| 307 |
+
port = int(os.environ.get("PORT", 7860))
|
| 308 |
+
app.run(host="0.0.0.0", port=port)
|