File size: 776 Bytes
0fbea6f
596b8f0
 
0fbea6f
625f628
596b8f0
 
 
 
625f628
596b8f0
 
 
 
0fbea6f
596b8f0
 
 
625f628
 
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
24
import gradio as gr
import requests
import os

def function1(user, message, code, option):
    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. Mode: {option}"
        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"),
    gr.inputs.Textbox(label="Textbox4",type="text")
]

iface = gr.Interface(fn=function1, inputs=inputs, outputs="text")
iface.launch()