Instructions to use A10Narvaez/Grupo1_Asistente_Redaccion with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use A10Narvaez/Grupo1_Asistente_Redaccion with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("fill-mask", model="A10Narvaez/Grupo1_Asistente_Redaccion")# Load model directly from transformers import AutoTokenizer, AutoModelForMaskedLM tokenizer = AutoTokenizer.from_pretrained("A10Narvaez/Grupo1_Asistente_Redaccion") model = AutoModelForMaskedLM.from_pretrained("A10Narvaez/Grupo1_Asistente_Redaccion", device_map="auto") - Notebooks
- Google Colab
- Kaggle
File size: 2,777 Bytes
eb535a8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | #gmail librerías --------------------------
from Google import Create_Service
import base64
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
#chatbot librerías------------------------
import speech_recognition as sr
import pyttsx3, pywhatkit
#servidor google---------------------------------
CLIENT_SECRET_FILE = "trchatbot.json"
API_NAME = "gmail"
API_VERSION = "v1"
SCOPES = ["https://mail.google.com/"]
service = Create_Service(CLIENT_SECRET_FILE, API_NAME, API_VERSION, SCOPES)
#------------------------------------
listener = sr.Recognizer()
engine = pyttsx3.init()
voices = engine.getProperty("voices")
engine.setProperty("voice", voices[0].id)
#---------------------------------------------
mimeMessage = MIMEMultipart()
titulito = ""
mensajito = ""
def talk(text):
engine.say(text)
engine.runAndWait()
def listen():
try:
with sr.Microphone() as source:
print("Escuchando...")
pc = listener.listen(source)
rec = listener.recognize_google(pc, language='es-ES')
rec = rec.lower(0)
#if name in rec:
#rec = rec.replace(name, "")
except:
pass
return rec
def run_mike():
rec = listen()
if "correo" in rec:
print("¿A quién quieres que se lo envíe? ")
talk("¿A quién quieres que se lo mande?")
enviara()
else:
talk("No te he entendido")
def enviara():
rec = listen()
if "David" in rec:
print("¿Título?")
talk("¿Título?")
tituloo()
def tituloo():
rec = listen()
if " " in rec:
global titulito
titulito = rec
print("¿Qué mensaje quieres que le envíe?")
talk("¿Qué mensaje quieres que le envíe?")
mensajee()
def mensajee():
rec = listen()
if " " in rec:
global mensajito
mensajito = rec
print("¿Seguro que quieres que envíe este mensaje a David?")
talk("¿Seguro que quieres que envíe este mensaje a David?")
print(rec)
seguroo()
def seguroo():
rec = listen()
if "correcto" in rec:
mimeMessage["to"] = "sacuadrado2@espe.edu.ec"
mimeMessage["subject"] = titulito
emailMsg = mensajito
mimeMessage.attach(MIMEText(emailMsg, "plain"))
raw_string = base64.urlsafe_b64encode(mimeMessage.as_bytes()).decode()
message = service.users().messages().send(userId = "me", body = {"raw": raw_string}).execute()
print("Se ha enviado correctamente")
talk("Se ha enviado correctamente")
else:
pass
if __name__ == "__main__":
run_mike() |