sahanind commited on
Commit
b039b7b
·
verified ·
1 Parent(s): aa0f810

Update bot.py

Browse files
Files changed (1) hide show
  1. bot.py +26 -2
bot.py CHANGED
@@ -2,7 +2,8 @@ import os
2
  import logging
3
  from pyrogram.raw.all import layer
4
  from pyrogram import Client, idle, __version__
5
-
 
6
  from config import Config
7
 
8
  logging.basicConfig(
@@ -37,10 +38,33 @@ bot = Client(
37
  plugins=dict(root="plugins"),
38
  )
39
 
40
- bot.start()
 
 
 
 
 
 
 
 
41
  logger.info("Bot has started.")
42
  logger.info("**Bot Started**\n\n**Pyrogram Version:** %s \n**Layer:** %s", __version__, layer)
43
  logger.info("Developed by github.com/kalanakt Sponsored by www.netronk.com")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  idle()
45
  bot.stop()
46
  logger.info("Bot Stopped ;)")
 
2
  import logging
3
  from pyrogram.raw.all import layer
4
  from pyrogram import Client, idle, __version__
5
+ import threading
6
+ import asyncio
7
  from config import Config
8
 
9
  logging.basicConfig(
 
38
  plugins=dict(root="plugins"),
39
  )
40
 
41
+
42
+ def run_asyncio_main():
43
+ asyncio.run(bot.start())
44
+
45
+
46
+ thread = threading.Thread(target=run_asyncio_main)
47
+ thread.daemon = True # Set as daemon so it exits when main thread exits
48
+ thread.start()
49
+
50
  logger.info("Bot has started.")
51
  logger.info("**Bot Started**\n\n**Pyrogram Version:** %s \n**Layer:** %s", __version__, layer)
52
  logger.info("Developed by github.com/kalanakt Sponsored by www.netronk.com")
53
+
54
+ def nmtapifunc(text):
55
+ text = text
56
+ return text
57
+
58
+ gradio_interface = gradio.Interface(
59
+ fn=nmtapifunc,
60
+ inputs="text",
61
+ outputs="text",
62
+ title="En-Si NMT",
63
+ description="",
64
+ article="© zaanind 2024"
65
+ )
66
+ gradio_interface.launch()
67
+
68
  idle()
69
  bot.stop()
70
  logger.info("Bot Stopped ;)")