leilaghomashchi commited on
Commit
d2d8070
·
verified ·
1 Parent(s): 2823450

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -0
app.py CHANGED
@@ -75,16 +75,27 @@ class GroqAnonymizer:
75
  }
76
 
77
  try:
 
 
 
 
78
  response = requests.post(
79
  f"{self.config.base_url}/chat/completions",
80
  headers=headers,
81
  json=payload,
82
  timeout=30
83
  )
 
 
 
 
 
 
84
  response.raise_for_status()
85
  return response.json()
86
 
87
  except requests.exceptions.RequestException as e:
 
88
  raise Exception(f"خطا در ارتباط با Groq API: {str(e)}")
89
 
90
  def anonymize_text(self, text: str) -> Dict[str, Any]:
 
75
  }
76
 
77
  try:
78
+ print(f"DEBUG: Sending request to {self.config.base_url}/chat/completions")
79
+ print(f"DEBUG: Model: {self.config.model}")
80
+ print(f"DEBUG: Text length: {len(text)}")
81
+
82
  response = requests.post(
83
  f"{self.config.base_url}/chat/completions",
84
  headers=headers,
85
  json=payload,
86
  timeout=30
87
  )
88
+
89
+ print(f"DEBUG: Response status: {response.status_code}")
90
+
91
+ if response.status_code != 200:
92
+ print(f"DEBUG: Error response: {response.text}")
93
+
94
  response.raise_for_status()
95
  return response.json()
96
 
97
  except requests.exceptions.RequestException as e:
98
+ print(f"DEBUG: Request exception: {str(e)}")
99
  raise Exception(f"خطا در ارتباط با Groq API: {str(e)}")
100
 
101
  def anonymize_text(self, text: str) -> Dict[str, Any]: