Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,12 +9,11 @@ from dotenv import load_dotenv
|
|
| 9 |
load_dotenv()
|
| 10 |
|
| 11 |
# Set up Together.AI API Key (Replace with your actual key)
|
| 12 |
-
|
| 13 |
|
| 14 |
def clean_text(text):
|
| 15 |
"""Cleans extracted text for better processing by the model."""
|
| 16 |
print("cleaning")
|
| 17 |
-
print(together.api_key)
|
| 18 |
text = unicodedata.normalize("NFKC", text) # Normalize Unicode characters
|
| 19 |
text = re.sub(r'\s+', ' ', text).strip() # Remove extra spaces and newlines
|
| 20 |
text = re.sub(r'[^a-zA-Z0-9.,!?;:\'\"()\-]', ' ', text) # Keep basic punctuation
|
|
|
|
| 9 |
load_dotenv()
|
| 10 |
|
| 11 |
# Set up Together.AI API Key (Replace with your actual key)
|
| 12 |
+
assert os.getenv("TOGETHER_API_KEY"), "api key missing"
|
| 13 |
|
| 14 |
def clean_text(text):
|
| 15 |
"""Cleans extracted text for better processing by the model."""
|
| 16 |
print("cleaning")
|
|
|
|
| 17 |
text = unicodedata.normalize("NFKC", text) # Normalize Unicode characters
|
| 18 |
text = re.sub(r'\s+', ' ', text).strip() # Remove extra spaces and newlines
|
| 19 |
text = re.sub(r'[^a-zA-Z0-9.,!?;:\'\"()\-]', ' ', text) # Keep basic punctuation
|