File size: 1,237 Bytes
3364f99 ad6a8d9 3364f99 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | import os
import gradio as gr
from groq import Groq
client = Groq(
api_key=os.getenv("GROQ_API_KEY")
)
SYSTEM_PROMPT = """
You are a Senior Software QA Engineer.
Generate a professional bug report.
Use this format:
Bug Title:
Severity:
Priority:
Module:
Steps to Reproduce:
Expected Result:
Actual Result:
Possible Root Cause:
"""
def generate_bug_report(description):
try:
completion = client.chat.completions.create(
model="llama-3.3-70b-versatile",
messages=[
{
"role":"system",
"content":SYSTEM_PROMPT
},
{
"role":"user",
"content":description
}
],
temperature=0.3,
max_tokens=700
)
return completion.choices[0].message.content
except Exception as e:
return str(e)
demo = gr.Interface(
fn=generate_bug_report,
inputs=gr.Textbox(
lines=8,
placeholder="Describe the software bug..."
),
outputs=gr.Textbox(lines=20),
title="🐞 AI Bug Report Generator",
description="Generate professional software bug reports using AI."
)
demo.launch() |