import gradio as gr from telegram.ext import Updater, MessageHandler, Filters, CommandHandler, CallbackContext # Define your Telegram bot token here TELEGRAM_BOT_TOKEN = "6516533220:AAEoq0ohv4xAraIw7lB7BZVHKyUg85wo3mI" # Create a Gradio interface def greet(bot, update): message = update.message.text bot.send_message(chat_id=update.message.chat_id, text=f"Hello, you said: {message}") # Create a Gradio interface gr.Interface(fn=greet, inputs="text", outputs="text").launch(share=True) # Set up the Telegram bot updater = Updater(token=TELEGRAM_BOT_TOKEN, use_context=True) dispatcher = updater.dispatcher # Define a Telegram command handler def start(update, context): context.bot.send_message(chat_id=update.message.chat_id, text="Hello! I'm your Gradio Telegram Bot. Send me a message!") start_handler = CommandHandler('start', start) dispatcher.add_handler(start_handler) # Define a Telegram message handler def echo(update, context): context.bot.send_message(chat_id=update.message.chat_id, text=update.message.text) message_handler = MessageHandler(Filters.text & ~Filters.command, echo) dispatcher.add_handler(message_handler) # Start the Telegram bot updater.start_polling() updater.idle()