Arvind2006 commited on
Commit
c3d0861
·
verified ·
1 Parent(s): 009a783

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +2 -47
app.py CHANGED
@@ -2,53 +2,8 @@
2
  import sys
3
  sys.path.insert(0, ".")
4
 
5
- import gradio as gr
6
  from main import app
7
- import uvicorn
8
- import json
9
- from fastapi import FastAPI
10
- from explain_error import explain_error
11
-
12
- # Mount FastAPI app to Gradio
13
- demo = gr.Blocks()
14
-
15
- with demo:
16
- gr.Markdown("# Jenkins Error Explainer")
17
- gr.Markdown("AI-powered Jenkins error explanation using RAG")
18
-
19
- with gr.Row():
20
- with gr.Column():
21
- log_input = gr.Textbox(
22
- lines=10,
23
- placeholder="Paste your Jenkins error log here...",
24
- label="Error Log"
25
- )
26
- explain_btn = gr.Button("Explain Error")
27
-
28
- with gr.Column():
29
- output = gr.Textbox(
30
- lines=15,
31
- label="Error Explanation",
32
- interactive=False
33
- )
34
-
35
- def explain_error_gradio(log_text):
36
- if not log_text.strip():
37
- return "Please paste a Jenkins error log."
38
- try:
39
- result = explain_error(log_text)
40
- return json.dumps(result, indent=2)
41
- except Exception as e:
42
- return f"Error: {str(e)}"
43
-
44
- explain_btn.click(
45
- explain_error_gradio,
46
- inputs=log_input,
47
- outputs=output
48
- )
49
-
50
- # Mount FastAPI app
51
- app = gr.mount_gradio_app(app, demo, path="/")
52
 
53
  if __name__ == "__main__":
54
- demo.launch()
 
 
2
  import sys
3
  sys.path.insert(0, ".")
4
 
 
5
  from main import app
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
 
7
  if __name__ == "__main__":
8
+ import uvicorn
9
+ uvicorn.run(app, host="0.0.0.0", port=7860)