EricGEGE commited on
Commit
9f58f07
·
verified ·
1 Parent(s): b7608d5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -11,8 +11,6 @@ import gradio as gr
11
  # from transformers.utils.hub import move_cache
12
  #
13
  # move_cache()
14
-
15
- import asyncio
16
  from telegram import Bot
17
 
18
  token = '7370905765:AAHvmlw68cW7RxWzsJE1yxTzgf3xQFiokDo'
@@ -24,9 +22,9 @@ print(df_resume.head())
24
  model = SentenceTransformer("all-MiniLM-L6-v2")
25
  # file_name = 'questions.txt'
26
 
27
- async def send_telegram_message(token, chat_id, message):
28
  bot = Bot(token=token)
29
- await bot.send_message(chat_id=chat_id, text=message)
30
  print("Message sent successfully.")
31
 
32
 
@@ -81,7 +79,7 @@ def rag_chain(question,name):
81
  # with open('questions.txt', 'a',encoding='utf-8') as file:
82
  # file.write(f"\n\n{question}\n\n{country}\n\n{whatsapp}\n\n{name}||{sales}||{profit}||{product}")
83
  message = f"{name}\n\n{question}\n\n{ans}"
84
- asyncio.run(send_telegram_message(token, chat_id, message))
85
  return que,ans
86
  # rag_chain('I am very hungry.')
87
 
 
11
  # from transformers.utils.hub import move_cache
12
  #
13
  # move_cache()
 
 
14
  from telegram import Bot
15
 
16
  token = '7370905765:AAHvmlw68cW7RxWzsJE1yxTzgf3xQFiokDo'
 
22
  model = SentenceTransformer("all-MiniLM-L6-v2")
23
  # file_name = 'questions.txt'
24
 
25
+ def send_telegram_message(token, chat_id, message):
26
  bot = Bot(token=token)
27
+ bot.send_message(chat_id=chat_id, text=message)
28
  print("Message sent successfully.")
29
 
30
 
 
79
  # with open('questions.txt', 'a',encoding='utf-8') as file:
80
  # file.write(f"\n\n{question}\n\n{country}\n\n{whatsapp}\n\n{name}||{sales}||{profit}||{product}")
81
  message = f"{name}\n\n{question}\n\n{ans}"
82
+ send_telegram_message(token, chat_id, message)
83
  return que,ans
84
  # rag_chain('I am very hungry.')
85