Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -5,10 +5,17 @@ from email.header import decode_header
|
|
5 |
import mysql.connector
|
6 |
from transformers import pipeline, AutoTokenizer, AutoModelForCausalLM
|
7 |
import email, imaplib, json, time
|
8 |
-
import torch
|
|
|
9 |
|
10 |
app = FastAPI()
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
# Global variable to control the main loop
|
13 |
running = True
|
14 |
IMAP_SERVER = 'imap.gmail.com'
|
@@ -368,7 +375,8 @@ async def stop_processing():
|
|
368 |
# Start the email processing loop when the app runs
|
369 |
if __name__ == "__main__":
|
370 |
print('starting')
|
|
|
371 |
running = True
|
372 |
threading.Thread(target=email_processing_loop, daemon=True).start()
|
373 |
-
|
374 |
uvicorn.run()
|
|
|
5 |
import mysql.connector
|
6 |
from transformers import pipeline, AutoTokenizer, AutoModelForCausalLM
|
7 |
import email, imaplib, json, time
|
8 |
+
import torch, logging
|
9 |
+
import uvicorn
|
10 |
|
11 |
app = FastAPI()
|
12 |
|
13 |
+
# Configure the logging
|
14 |
+
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
15 |
+
|
16 |
+
# Create a logger instance
|
17 |
+
logging = logging.getLogger(__name__)
|
18 |
+
|
19 |
# Global variable to control the main loop
|
20 |
running = True
|
21 |
IMAP_SERVER = 'imap.gmail.com'
|
|
|
375 |
# Start the email processing loop when the app runs
|
376 |
if __name__ == "__main__":
|
377 |
print('starting')
|
378 |
+
logging.info('starting project!...')
|
379 |
running = True
|
380 |
threading.Thread(target=email_processing_loop, daemon=True).start()
|
381 |
+
logging.info('...')
|
382 |
uvicorn.run()
|