Update app.py
Browse files
app.py
CHANGED
@@ -1,20 +1,23 @@
|
|
1 |
import numpy as np
|
2 |
import pandas as pd
|
3 |
-
|
4 |
from sentence_transformers import SentenceTransformer
|
5 |
|
|
|
6 |
from sklearn.metrics import DistanceMetric
|
7 |
|
|
|
|
|
8 |
import warnings
|
9 |
warnings.filterwarnings("ignore")
|
10 |
import gradio as gr
|
11 |
# from transformers.utils.hub import move_cache
|
12 |
#
|
13 |
# move_cache()
|
14 |
-
from
|
15 |
|
16 |
-
|
17 |
-
|
18 |
|
19 |
token = '7370905765:AAHvmlw68cW7RxWzsJE1yxTzgf3xQFiokDo'
|
20 |
chat_id = '7431171535'
|
@@ -25,13 +28,10 @@ print(df_resume.head())
|
|
25 |
model = SentenceTransformer("all-MiniLM-L6-v2")
|
26 |
# file_name = 'questions.txt'
|
27 |
|
28 |
-
def send_telegram_message(token, chat_id, message):
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
logger.info("Message sent successfully.")
|
33 |
-
except TelegramError as e:
|
34 |
-
logger.error(f"Failed to send message: {e}")
|
35 |
|
36 |
|
37 |
def savevectorstore():
|
@@ -85,10 +85,8 @@ def rag_chain(question,name):
|
|
85 |
# with open('questions.txt', 'a',encoding='utf-8') as file:
|
86 |
# file.write(f"\n\n{question}\n\n{country}\n\n{whatsapp}\n\n{name}||{sales}||{profit}||{product}")
|
87 |
message = f"{name}\n\n{question}\n\n{ans}"
|
88 |
-
|
89 |
-
|
90 |
-
else:
|
91 |
-
send_telegram_message(token, chat_id, message)
|
92 |
return que,ans
|
93 |
# rag_chain('I am very hungry.')
|
94 |
|
|
|
1 |
import numpy as np
|
2 |
import pandas as pd
|
3 |
+
|
4 |
from sentence_transformers import SentenceTransformer
|
5 |
|
6 |
+
from sklearn.decomposition import PCA
|
7 |
from sklearn.metrics import DistanceMetric
|
8 |
|
9 |
+
import matplotlib.pyplot as plt
|
10 |
+
import matplotlib as mpl
|
11 |
import warnings
|
12 |
warnings.filterwarnings("ignore")
|
13 |
import gradio as gr
|
14 |
# from transformers.utils.hub import move_cache
|
15 |
#
|
16 |
# move_cache()
|
17 |
+
from mailersend import emails
|
18 |
|
19 |
+
import asyncio
|
20 |
+
from telegram import Bot
|
21 |
|
22 |
token = '7370905765:AAHvmlw68cW7RxWzsJE1yxTzgf3xQFiokDo'
|
23 |
chat_id = '7431171535'
|
|
|
28 |
model = SentenceTransformer("all-MiniLM-L6-v2")
|
29 |
# file_name = 'questions.txt'
|
30 |
|
31 |
+
async def send_telegram_message(token, chat_id, message):
|
32 |
+
bot = Bot(token=token)
|
33 |
+
await bot.send_message(chat_id=chat_id, text=message)
|
34 |
+
print("Message sent successfully.")
|
|
|
|
|
|
|
35 |
|
36 |
|
37 |
def savevectorstore():
|
|
|
85 |
# with open('questions.txt', 'a',encoding='utf-8') as file:
|
86 |
# file.write(f"\n\n{question}\n\n{country}\n\n{whatsapp}\n\n{name}||{sales}||{profit}||{product}")
|
87 |
message = f"{name}\n\n{question}\n\n{ans}"
|
88 |
+
asyncio.run(send_telegram_message(token, chat_id, message))
|
89 |
+
print('Successfully sent!')
|
|
|
|
|
90 |
return que,ans
|
91 |
# rag_chain('I am very hungry.')
|
92 |
|