Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,25 +4,23 @@ from telegram import Update
|
|
| 4 |
from telegram.ext import ApplicationBuilder, CommandHandler, ContextTypes
|
| 5 |
|
| 6 |
# ====== Telegram Bot Setup ======
|
| 7 |
-
TELEGRAM_TOKEN = "8030235633:
|
| 8 |
|
| 9 |
-
#
|
| 10 |
async def start(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
| 11 |
await update.message.reply_text("Hello! I'm your bot!")
|
| 12 |
|
| 13 |
# ====== Gradio App Setup ======
|
| 14 |
-
|
| 15 |
def greet(name):
|
| 16 |
return f"Hello, {name}!"
|
| 17 |
|
| 18 |
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 19 |
|
| 20 |
-
# Function to run Gradio (no SSR or share
|
| 21 |
def run_gradio():
|
| 22 |
-
demo.launch(
|
| 23 |
|
| 24 |
# ====== Start Both Gradio & Telegram Bot ======
|
| 25 |
-
|
| 26 |
if __name__ == "__main__":
|
| 27 |
# Start Gradio in a separate thread
|
| 28 |
gradio_thread = threading.Thread(target=run_gradio)
|
|
|
|
| 4 |
from telegram.ext import ApplicationBuilder, CommandHandler, ContextTypes
|
| 5 |
|
| 6 |
# ====== Telegram Bot Setup ======
|
| 7 |
+
TELEGRAM_TOKEN = "8030235633:AAHKvxM9Nzp0DkxfdotMux3572tC_5CGEUAE" # Replace this with your real bot token
|
| 8 |
|
| 9 |
+
# Telegram command handler
|
| 10 |
async def start(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
| 11 |
await update.message.reply_text("Hello! I'm your bot!")
|
| 12 |
|
| 13 |
# ====== Gradio App Setup ======
|
|
|
|
| 14 |
def greet(name):
|
| 15 |
return f"Hello, {name}!"
|
| 16 |
|
| 17 |
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 18 |
|
| 19 |
+
# Function to run Gradio (no SSR or share needed on Spaces)
|
| 20 |
def run_gradio():
|
| 21 |
+
demo.launch() # No SSR or share argument needed
|
| 22 |
|
| 23 |
# ====== Start Both Gradio & Telegram Bot ======
|
|
|
|
| 24 |
if __name__ == "__main__":
|
| 25 |
# Start Gradio in a separate thread
|
| 26 |
gradio_thread = threading.Thread(target=run_gradio)
|