JSchmie / ScrAIbe-WebUI

WebUI for ScAIbe
https://github.com/JSchmie/ScrAIbe-WebUI
GNU General Public License v3.0
14 stars 2 forks source link

Help with SMTP settings in async mode #45

Open friki67 opened 5 hours ago

friki67 commented 5 hours ago

Docker installation. Just changed config.yaml and tried to use the async mode. In simple mode is working ok.

What am I doing wrong?

config.yaml

interface_type: async  # aync or simple variant of the Interface (one does transcriptions does require Email setup)
scraibe_params:
  # whisper_model : null
  whisper_type: whisperX # whether use orginal whisper or whisperX backend
  # dia_model: null
  # use_auth_token: null
  device: cuda # set your device
  # num_threads: 0 # If CPU is used set number of useable threads
mail:
  sender_email : myaccount@gmail.com 
  smtp_server : smtp.gmail.com
  smtp_port : 465
  sender_password : mygmailperapppassword
  context_kwargs : {}
  default_subject: "SCRAIBE"
  error_template: scraibe_webui/misc/error_notification_template.html
  error_subject: An error occured during processing.
  error_format_options:
   ##exception is mandatroy for your html  will be set to the related exepttion in the Code
   contact_email: myaccount@gmail.com # set this to your mail if you are using a custom error_template you can add an any amount of format options here.
  success_template: scraibe_webui/misc/success_template.html
  success_subject: "Your transcript is ready."
  success_format_options: 
    contact_email: myaccount@gmail.com
  upload_notification_template: scraibe_webui/misc/upload_notification_template.html
  upload_subject: "Upload Successful"
  upload_notification_format_options:
    queue_position: null
    contact_email: myaccount@gmail.com
  mail_css_path: scraibe_webui/misc/mail_style.css
advanced:
  keep_model_alive: false # for sync interfac only keeps the model alvide during a session 
  concurrent_workers_async: 1 # number of concurrent working threads in the async interface

log

No language specified, language will be first be detected for each audio file (increases inference time).
Lightning automatically upgraded your loaded checkpoint from v1.5.4 to v2.2.5. To apply the upgrade to your files permanently, run `python -m pytorch_lightning.utilities.upgrade_checkpoint ../root/.cache/torch/whisperx-vad-segmentation.bin`
Model was trained with pyannote.audio 0.0.1, yours is 3.1.1. Bad things might happen unless you revert pyannote.audio to 0.x.
Model was trained with torch 1.10.0+cu102, yours is 2.3.0. Bad things might happen unless you revert torch to 1.x.
Traceback (most recent call last):
  File "/opt/conda/lib/python3.10/site-packages/gradio/queueing.py", line 521, in process_events
    response = await route_utils.call_process_api(
  File "/opt/conda/lib/python3.10/site-packages/gradio/route_utils.py", line 276, in call_process_api
    output = await app.get_blocks().process_api(
  File "/opt/conda/lib/python3.10/site-packages/gradio/blocks.py", line 1945, in process_api
    result = await self.call_function(
  File "/opt/conda/lib/python3.10/site-packages/gradio/blocks.py", line 1525, in call_function
    prediction = await utils.async_iteration(iterator)
  File "/opt/conda/lib/python3.10/site-packages/gradio/utils.py", line 655, in async_iteration
    return await iterator.__anext__()
  File "/opt/conda/lib/python3.10/site-packages/gradio/utils.py", line 648, in __anext__
    return await anyio.to_thread.run_sync(
  File "/opt/conda/lib/python3.10/site-packages/anyio/to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
  File "/opt/conda/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2177, in run_sync_in_worker_thread
    return await future
  File "/opt/conda/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 859, in run
    result = context.run(func, *args)
  File "/opt/conda/lib/python3.10/site-packages/gradio/utils.py", line 631, in run_sync_iterator_async
    return next(iterator)
  File "/opt/conda/lib/python3.10/site-packages/gradio/utils.py", line 814, in gen_wrapper
    response = next(iterator)
  File "/app/scraibe_webui/utils/interactions.py", line 215, in run_scraibe_async
    MailService.from_config(mail_service_params).send_upload_notification(mail, **upload_format_options)
  File "/app/scraibe_webui/utils/mail.py", line 214, in from_config
    return cls(sender_email=config['sender_email'],
  File "/app/scraibe_webui/utils/mail.py", line 68, in __init__
    self.mailserver = self.setup_mailserver()
  File "/app/scraibe_webui/utils/mail.py", line 78, in setup_mailserver
    login = self.test_login()
  File "/app/scraibe_webui/utils/mail.py", line 100, in test_login
    with smtplib.SMTP(self.smtp_server, self.smtp_port) as server:
  File "/opt/conda/lib/python3.10/smtplib.py", line 255, in __init__
    (code, msg) = self.connect(host, port)
  File "/opt/conda/lib/python3.10/smtplib.py", line 343, in connect
    (code, msg) = self.getreply()
  File "/opt/conda/lib/python3.10/smtplib.py", line 405, in getreply
    raise SMTPServerDisconnected("Connection unexpectedly closed")
smtplib.SMTPServerDisconnected: Connection unexpectedly closed
Warning: audio is shorter than 30s, language detection may be inaccurate.
Detected language: es (0.98) in first 30s of audio...
Warning: audio is shorter than 30s, language detection may be inaccurate.
Detected language: es (0.56) in first 30s of audio...
Warning: audio is shorter than 30s, language detection may be inaccurate.
.
.
.
.
Detected language: es (0.94) in first 30s of audio...
Warning: audio is shorter than 30s, language detection may be inaccurate.
Detected language: es (0.91) in first 30s of audio...
Warning: audio is shorter than 30s, language detection may be inaccurate.
Detected language: es (0.97) in first 30s of audio...
Exception in thread Thread-6 (parrallel_task):
Traceback (most recent call last):
  File "/app/scraibe_webui/utils/background.py", line 154, in parrallel_task
    MailService.from_config(self.mail_service_params).send_transcript(receiver_email=reciever, transcript_path = temp_files, **success_format_option)
  File "/app/scraibe_webui/utils/mail.py", line 214, in from_config
    return cls(sender_email=config['sender_email'],
  File "/app/scraibe_webui/utils/mail.py", line 68, in __init__
    self.mailserver = self.setup_mailserver()
  File "/app/scraibe_webui/utils/mail.py", line 78, in setup_mailserver
    login = self.test_login()
  File "/app/scraibe_webui/utils/mail.py", line 100, in test_login
    with smtplib.SMTP(self.smtp_server, self.smtp_port) as server:
  File "/opt/conda/lib/python3.10/smtplib.py", line 255, in __init__
    (code, msg) = self.connect(host, port)
  File "/opt/conda/lib/python3.10/smtplib.py", line 343, in connect
    (code, msg) = self.getreply()
  File "/opt/conda/lib/python3.10/smtplib.py", line 405, in getreply
    raise SMTPServerDisconnected("Connection unexpectedly closed")
smtplib.SMTPServerDisconnected: Connection unexpectedly closed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/conda/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/app/scraibe_webui/utils/background.py", line 21, in run
    self._target(*self._args, **self._kwargs)
  File "/app/scraibe_webui/utils/background.py", line 158, in parrallel_task
    MailService.from_config(self.mail_service_params).send_error_notification(receiver_email = reciever, exception_message = exeption, **error_format_options)
  File "/app/scraibe_webui/utils/mail.py", line 214, in from_config
    return cls(sender_email=config['sender_email'],
  File "/app/scraibe_webui/utils/mail.py", line 68, in __init__
    self.mailserver = self.setup_mailserver()
  File "/app/scraibe_webui/utils/mail.py", line 78, in setup_mailserver
    login = self.test_login()
  File "/app/scraibe_webui/utils/mail.py", line 100, in test_login
    with smtplib.SMTP(self.smtp_server, self.smtp_port) as server:
  File "/opt/conda/lib/python3.10/smtplib.py", line 255, in __init__
    (code, msg) = self.connect(host, port)
  File "/opt/conda/lib/python3.10/smtplib.py", line 343, in connect
    (code, msg) = self.getreply()
  File "/opt/conda/lib/python3.10/smtplib.py", line 405, in getreply
    raise SMTPServerDisconnected("Connection unexpectedly closed")
smtplib.SMTPServerDisconnected: Connection unexpectedly closed
JSchmie commented 4 hours ago

Hi @friki67,

It appears that the error originates from the smtplib library, and since you're using Gmail (smtp.gmail.com), there are additional steps needed to enable email functionality with Python.

Gmail requires you to configure your account for apps like this. Specifically, you'll need to generate a 16-digit app password, as Google restricts access from less secure apps. You can follow this short tutorial here for guidance.

"A 16-digit passcode is generated in your Google account and allows less secure apps or devices that don’t support 2-step verification to sign in to your Gmail account."

Please ensure your Gmail setup is correct. If the issue persists, feel free to ask for further assistance!

friki67 commented 2 hours ago

Hello. Yes, I did the app password thing in Google. I did it for other apps and usually it worked. :/. I think I'm failing in some other parameter