Update bot.py
Browse files
bot.py
CHANGED
|
@@ -39,37 +39,38 @@ bot = Client(
|
|
| 39 |
workers=50,
|
| 40 |
plugins=dict(root="plugins"),
|
| 41 |
)
|
| 42 |
-
def start_botcc():
|
| 43 |
-
bot.start()
|
| 44 |
-
logger.info("Bot has started.")
|
| 45 |
-
logger.info("**Bot Started**\n\n**Pyrogram Version:** %s \n**Layer:** %s", __version__, layer)
|
| 46 |
-
logger.info("Developed by github.com/kalanakt Sponsored by www.netronk.com")
|
| 47 |
-
idle()
|
| 48 |
-
bot.stop()
|
| 49 |
-
logger.info("Bot Stopped ;)")
|
| 50 |
|
| 51 |
-
def
|
| 52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
|
| 54 |
|
| 55 |
-
thread = threading.Thread(target=start_botcc)
|
| 56 |
-
thread.daemon = True # Set as daemon so it exits when main thread exits
|
| 57 |
-
thread.start()
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
-
def nmtapifunc(text):
|
| 62 |
-
text = text
|
| 63 |
-
return text
|
| 64 |
|
| 65 |
-
gradio_interface = gradio.Interface(
|
| 66 |
-
fn=nmtapifunc,
|
| 67 |
-
inputs="text",
|
| 68 |
-
outputs="text",
|
| 69 |
-
title="En-Si NMT",
|
| 70 |
-
description="",
|
| 71 |
-
article="© zn 2024"
|
| 72 |
-
)
|
| 73 |
-
gradio_interface.launch()
|
| 74 |
|
| 75 |
|
|
|
|
| 39 |
workers=50,
|
| 40 |
plugins=dict(root="plugins"),
|
| 41 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
+
def nmtapifunc(text):
|
| 44 |
+
return text
|
| 45 |
+
|
| 46 |
+
# Running Gradio in a separate thread
|
| 47 |
+
def start_gradio():
|
| 48 |
+
gradio_interface = gradio.Interface(
|
| 49 |
+
fn=nmtapifunc,
|
| 50 |
+
inputs="text",
|
| 51 |
+
outputs="text",
|
| 52 |
+
title="En-Si NMT",
|
| 53 |
+
description="",
|
| 54 |
+
article="© zn 2024"
|
| 55 |
+
)
|
| 56 |
+
gradio_interface.launch()
|
| 57 |
+
|
| 58 |
+
gradio_thread = threading.Thread(target=start_gradio)
|
| 59 |
+
gradio_thread.daemon = True
|
| 60 |
+
gradio_thread.start()
|
| 61 |
+
|
| 62 |
+
bot.start()
|
| 63 |
+
logger.info("Bot has started.")
|
| 64 |
+
logger.info("**Bot Started**\n\n**Pyrogram Version:** %s \n**Layer:** %s", __version__, layer)
|
| 65 |
+
logger.info("Developed by github.com/kalanakt Sponsored by www.netronk.com")
|
| 66 |
+
idle()
|
| 67 |
+
bot.stop()
|
| 68 |
+
logger.info("Bot Stopped ;)")
|
| 69 |
|
| 70 |
|
|
|
|
|
|
|
|
|
|
| 71 |
|
| 72 |
|
| 73 |
|
|
|
|
|
|
|
|
|
|
| 74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
|
| 76 |
|