| 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() |