anky2002 commited on
Commit
d6d0dff
Β·
verified Β·
1 Parent(s): 617ed10

Upload export.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. export.py +3 -32
export.py CHANGED
@@ -16,38 +16,9 @@ from typing import Optional
16
  # ─── LLM Formatter ──────────────────────────────────────────────────
17
 
18
  def _format_with_llm(raw_report: str, format_type: str) -> Optional[str]:
19
- """Use Qwen2.5-72B-Instruct to polish the report into professional format."""
20
- token = os.environ.get("HF_TOKEN", "")
21
- if not token:
22
- return None
23
-
24
- try:
25
- from openai import OpenAI
26
- client = OpenAI(base_url="https://router.huggingface.co/v1", api_key=token)
27
-
28
- system = f"""You are a professional forensic report formatter. Take the raw FORENSIQ analysis data and reformat it into a clean, professional {format_type} document.
29
-
30
- Rules:
31
- - Preserve ALL data, scores, and findings exactly as given β€” do not invent or modify any values
32
- - Organize with clear headers, tables, and sections
33
- - Use professional forensic language
34
- - Include the verdict, probability, all agent findings, and methodology statement
35
- - For PDF/DOCX: structure with numbered sections (I, II, III...)
36
- - For TXT: use clean ASCII formatting with consistent indentation
37
- - Keep it concise but complete β€” every data point must appear"""
38
-
39
- resp = client.chat.completions.create(
40
- model="Qwen/Qwen2.5-72B-Instruct",
41
- messages=[
42
- {"role": "system", "content": system},
43
- {"role": "user", "content": f"Format this forensic report for {format_type} export:\n\n{raw_report[:8000]}"}
44
- ],
45
- max_tokens=4000,
46
- temperature=0.1,
47
- )
48
- return resp.choices[0].message.content
49
- except Exception as e:
50
- return None
51
 
52
 
53
  # ─── Strip Markdown Helper ──────────────────────────────────────────
 
16
  # ─── LLM Formatter ──────────────────────────────────────────────────
17
 
18
  def _format_with_llm(raw_report: str, format_type: str) -> Optional[str]:
19
+ """Skip LLM formatting β€” export instantly with raw data.
20
+ The reports from explanation.py are already professionally formatted."""
21
+ return None
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
 
24
  # ─── Strip Markdown Helper ──────────────────────────────────────────