File size: 699 Bytes
0fbea6f 596b8f0 0fbea6f 3327b62 596b8f0 69067a7 596b8f0 0fbea6f 596b8f0 3327b62 596b8f0 7805c2a 0fbea6f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import gradio as gr
import requests
import os
def function1(user, message, code):
token = os.environ.get("token")
Code = os.environ.get("code")
userID = os.environ.get("userID")
if code == Code:
endpoint = f"https://api.telegram.org/bot{token}/sendMessage?chat_id={userID}&text={user} asked: {message} to JohnAI"
send_response = requests.post(endpoint)
return "Done"
else:
return "Failed"
inputs = [
gr.inputs.Textbox(label="Textbox1",type="text"),
gr.inputs.Textbox(label="Textbox2",type="text"),
gr.inputs.Textbox(label="Textbox3",type="password")
]
iface = gr.Interface(fn=function1, inputs=inputs, outputs="text")
iface.launch() |