Upload folder using huggingface_hub
Browse files- README.md +2 -2
- app.py +27 -5
- main.py +0 -7
- requirements.txt +1 -9
- retrieve_docs.py +2 -2
README.md
CHANGED
|
@@ -3,8 +3,8 @@ title: Jenkins Error Explainer
|
|
| 3 |
emoji: 🔧
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: green
|
| 6 |
-
sdk:
|
| 7 |
-
sdk_version: "
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
---
|
|
|
|
| 3 |
emoji: 🔧
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: green
|
| 6 |
+
sdk: gradio
|
| 7 |
+
sdk_version: "4.0.0"
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
---
|
app.py
CHANGED
|
@@ -1,9 +1,31 @@
|
|
| 1 |
-
# app.py - Entry point for HuggingFace Spaces
|
| 2 |
import sys
|
| 3 |
sys.path.insert(0, ".")
|
| 4 |
|
| 5 |
-
|
|
|
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# app.py - Entry point for HuggingFace Spaces (Gradio)
|
| 2 |
import sys
|
| 3 |
sys.path.insert(0, ".")
|
| 4 |
|
| 5 |
+
import gradio as gr
|
| 6 |
+
from explain_error import explain_error
|
| 7 |
|
| 8 |
+
def explain_jenkins_error(log_text):
|
| 9 |
+
"""Explain Jenkins error from log text."""
|
| 10 |
+
if not log_text.strip():
|
| 11 |
+
return "Please provide a Jenkins error log."
|
| 12 |
+
result = explain_error(log_text)
|
| 13 |
+
return f"""**Error Category:** {result['error_category']}
|
| 14 |
+
|
| 15 |
+
**Summary:** {result['summary']}
|
| 16 |
+
|
| 17 |
+
**Likely Causes:**
|
| 18 |
+
{chr(10).join('- ' + cause for cause in result['likely_causes'])}
|
| 19 |
+
|
| 20 |
+
**References:**
|
| 21 |
+
{chr(10).join('- ' + ref for ref in result['references'])}"""
|
| 22 |
+
|
| 23 |
+
demo = gr.Interface(
|
| 24 |
+
fn=explain_jenkins_error,
|
| 25 |
+
inputs=gr.Textbox(label="Jenkins Error Log", placeholder="Paste your Jenkins error log here..."),
|
| 26 |
+
outputs=gr.Markdown(label="Explanation"),
|
| 27 |
+
title="Jenkins Error Explainer",
|
| 28 |
+
description="AI-powered Jenkins pipeline error diagnosis using RAG"
|
| 29 |
+
)
|
| 30 |
+
|
| 31 |
+
demo.launch()
|
main.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
from explain_error import explain_error
|
| 3 |
-
from langchain_rag import get_rag_chain
|
| 4 |
|
| 5 |
app = FastAPI()
|
| 6 |
|
|
@@ -12,9 +11,3 @@ def home():
|
|
| 12 |
def explain(payload: dict):
|
| 13 |
log = payload["log_text"]
|
| 14 |
return explain_error(log)
|
| 15 |
-
|
| 16 |
-
@app.post("/explain-rag")
|
| 17 |
-
def explain_with_rag(payload: dict):
|
| 18 |
-
log = payload["log_text"]
|
| 19 |
-
rag_chain = get_rag_chain()
|
| 20 |
-
return rag_chain.explain_error(log)
|
|
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
from explain_error import explain_error
|
|
|
|
| 3 |
|
| 4 |
app = FastAPI()
|
| 5 |
|
|
|
|
| 11 |
def explain(payload: dict):
|
| 12 |
log = payload["log_text"]
|
| 13 |
return explain_error(log)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
requirements.txt
CHANGED
|
@@ -1,15 +1,7 @@
|
|
| 1 |
fastapi
|
| 2 |
uvicorn[standard]
|
| 3 |
sentence-transformers
|
| 4 |
-
huggingface_hub
|
| 5 |
faiss-cpu
|
| 6 |
numpy
|
| 7 |
pydantic
|
| 8 |
-
|
| 9 |
-
transformers
|
| 10 |
-
tokenizers
|
| 11 |
-
langchain
|
| 12 |
-
langchain-core
|
| 13 |
-
langchain-community
|
| 14 |
-
langchain-huggingface
|
| 15 |
-
chromadb
|
|
|
|
| 1 |
fastapi
|
| 2 |
uvicorn[standard]
|
| 3 |
sentence-transformers
|
|
|
|
| 4 |
faiss-cpu
|
| 5 |
numpy
|
| 6 |
pydantic
|
| 7 |
+
gradio
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
retrieve_docs.py
CHANGED
|
@@ -19,8 +19,8 @@ QUERY_TEMPLATES = {
|
|
| 19 |
"git_authentication_error": "Jenkins git authentication failed checkout"
|
| 20 |
}
|
| 21 |
model = SentenceTransformer(
|
| 22 |
-
"
|
| 23 |
-
cache_folder="./
|
| 24 |
)
|
| 25 |
|
| 26 |
def retrieve_docs(error_category: str):
|
|
|
|
| 19 |
"git_authentication_error": "Jenkins git authentication failed checkout"
|
| 20 |
}
|
| 21 |
model = SentenceTransformer(
|
| 22 |
+
"all-MiniLM-L6-v2",
|
| 23 |
+
cache_folder="./models"
|
| 24 |
)
|
| 25 |
|
| 26 |
def retrieve_docs(error_category: str):
|