Spaces:
Sleeping
Sleeping
Upload 3 files
Browse files- README.md +0 -13
- app.py +84 -0
- requirements.txt +2 -0
README.md
CHANGED
|
@@ -1,13 +0,0 @@
|
|
| 1 |
-
---
|
| 2 |
-
title: AgenticBA
|
| 3 |
-
emoji: 🏢
|
| 4 |
-
colorFrom: purple
|
| 5 |
-
colorTo: gray
|
| 6 |
-
sdk: gradio
|
| 7 |
-
sdk_version: 6.10.0
|
| 8 |
-
app_file: app.py
|
| 9 |
-
pinned: false
|
| 10 |
-
short_description: This as an agentic AI tool that FOR BA's
|
| 11 |
-
---
|
| 12 |
-
|
| 13 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app.py
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import requests
|
| 2 |
+
|
| 3 |
+
def read_notes(file_path):
|
| 4 |
+
with open(file_path, "r", encoding="utf-8") as file:
|
| 5 |
+
return file.read().strip()
|
| 6 |
+
|
| 7 |
+
def ask_ollama(prompt, model="gemma3:4b"):
|
| 8 |
+
print(f"Talking to Ollama using model: {model}...")
|
| 9 |
+
url = "http://localhost:11434/api/generate"
|
| 10 |
+
|
| 11 |
+
response = requests.post(url, json={
|
| 12 |
+
"model": model,
|
| 13 |
+
"prompt": prompt,
|
| 14 |
+
"stream": False
|
| 15 |
+
}, timeout=300)
|
| 16 |
+
|
| 17 |
+
if response.status_code != 200:
|
| 18 |
+
print("Ollama error:")
|
| 19 |
+
print(response.text)
|
| 20 |
+
response.raise_for_status()
|
| 21 |
+
|
| 22 |
+
data = response.json()
|
| 23 |
+
return data["response"].strip()
|
| 24 |
+
|
| 25 |
+
def save_file(file_path, content):
|
| 26 |
+
with open(file_path, "w", encoding="utf-8") as file:
|
| 27 |
+
file.write(content)
|
| 28 |
+
|
| 29 |
+
print("Reading notes...")
|
| 30 |
+
notes = read_notes("notes.txt")
|
| 31 |
+
|
| 32 |
+
print("Generating BRD...")
|
| 33 |
+
brd_prompt = f"""
|
| 34 |
+
You are a senior Business Analyst.
|
| 35 |
+
|
| 36 |
+
Convert the following raw stakeholder notes into a clean Business Requirements Document.
|
| 37 |
+
|
| 38 |
+
Include:
|
| 39 |
+
1. Project Title
|
| 40 |
+
2. Business Problem
|
| 41 |
+
3. Objectives
|
| 42 |
+
4. Scope
|
| 43 |
+
5. Functional Requirements
|
| 44 |
+
6. Non-Functional Requirements
|
| 45 |
+
7. Assumptions
|
| 46 |
+
8. Risks
|
| 47 |
+
9. Success Metrics
|
| 48 |
+
|
| 49 |
+
Raw Notes:
|
| 50 |
+
{notes}
|
| 51 |
+
"""
|
| 52 |
+
|
| 53 |
+
print("Generating User Stories...")
|
| 54 |
+
stories_prompt = f"""
|
| 55 |
+
You are a Business Analyst.
|
| 56 |
+
|
| 57 |
+
Using the stakeholder notes below, create BDD-style user stories.
|
| 58 |
+
|
| 59 |
+
Format each item like:
|
| 60 |
+
|
| 61 |
+
User Story:
|
| 62 |
+
As a ...
|
| 63 |
+
I want ...
|
| 64 |
+
So that ...
|
| 65 |
+
|
| 66 |
+
Acceptance Criteria:
|
| 67 |
+
Given ...
|
| 68 |
+
When ...
|
| 69 |
+
Then ...
|
| 70 |
+
|
| 71 |
+
Raw Notes:
|
| 72 |
+
{notes}
|
| 73 |
+
"""
|
| 74 |
+
|
| 75 |
+
brd = ask_ollama(brd_prompt)
|
| 76 |
+
stories = ask_ollama(stories_prompt)
|
| 77 |
+
|
| 78 |
+
print("Saving files...")
|
| 79 |
+
save_file("output_brd.md", brd)
|
| 80 |
+
save_file("output_user_stories.md", stories)
|
| 81 |
+
|
| 82 |
+
print("Done! Files created:")
|
| 83 |
+
print("- output_brd.md")
|
| 84 |
+
print("- output_user_stories.md")
|
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio
|
| 2 |
+
requests
|