Spaces:
kuro223
/
Runtime error

Tele / app.py
kuro223's picture
Update app.py
c523eef
raw
history blame
1.36 kB
import gradio as gr
import g4f
import telebot
import nest_asyncio
from g4f import Provider, models
from langchain.llms.base import LLM
from langchain_g4f import G4FLLM
from gradio_client import Client
client = Client("https://docfile-lll.hf.space/")
nest_asyncio.apply()
bot = telebot.TeleBot("6459409517:AAFt4bQkR5T2Wl-ojErf2yv-_I0LxF87QFQ")
@bot.message_handler(commands=['start', 'help'])
def send_welcome(message):
bot.reply_to(message, "Howdy, how are you doing? Hein ? ")
@bot.message_handler(func=lambda message: True)
def echo_all(message):
user_input = message.text
print(user_input)
user_input = str(user_input)
#response = g4f.ChatCompletion.create(model="gpt-3.5-turbo",provider=g4f.Provider.ChatgptLogin,messages=[{"role": "user", "content":user_input}],stream=False)
llm = LLM = G4FLLM(
model=models.gpt_35_turbo,
provider=Provider.ChatgptLogin,
)
#res = llm(user_input)
result = client.predict(
user_input, # str in 'query' Textbox component
api_name="/predict")
bot.reply_to(message,result)
#bot.infinity_polling()
def addition(nombre1, nombre2):
resultat = nombre1 + nombre2
bot.infinity_polling()
return resultat
interface = gr.Interface(fn=addition, inputs=["number", "number"], outputs="number", live=True, title="Calculatrice")
interface.launch()