Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,8 @@
|
|
1 |
import gradio as gr
|
2 |
import g4f
|
3 |
import telebot
|
4 |
-
|
|
|
5 |
bot = telebot.TeleBot("6459409517:AAFt4bQkR5T2Wl-ojErf2yv-_I0LxF87QFQ")
|
6 |
|
7 |
@bot.message_handler(commands=['start', 'help'])
|
@@ -11,7 +12,7 @@ def send_welcome(message):
|
|
11 |
@bot.message_handler(func=lambda message: True)
|
12 |
def echo_all(message):
|
13 |
user_input = message.text
|
14 |
-
response = g4f.ChatCompletion.create(model="gpt-3.5-turbo",provider=g4f.Provider.
|
15 |
bot.reply_to(message,response)
|
16 |
|
17 |
#bot.infinity_polling()
|
|
|
1 |
import gradio as gr
|
2 |
import g4f
|
3 |
import telebot
|
4 |
+
import nest_asyncio
|
5 |
+
nest_asyncio.apply()
|
6 |
bot = telebot.TeleBot("6459409517:AAFt4bQkR5T2Wl-ojErf2yv-_I0LxF87QFQ")
|
7 |
|
8 |
@bot.message_handler(commands=['start', 'help'])
|
|
|
12 |
@bot.message_handler(func=lambda message: True)
|
13 |
def echo_all(message):
|
14 |
user_input = message.text
|
15 |
+
response = g4f.ChatCompletion.create(model="gpt-3.5-turbo",provider=g4f.Provider.Aichat,messages=[{"role": "user", "content":user_input}],stream=False)
|
16 |
bot.reply_to(message,response)
|
17 |
|
18 |
#bot.infinity_polling()
|