Update app.py
Browse files
app.py
CHANGED
@@ -2,12 +2,12 @@ import gradio as gr
|
|
2 |
import requests
|
3 |
import os
|
4 |
|
5 |
-
def function1(user, message, code):
|
6 |
token = os.environ.get("token")
|
7 |
Code = os.environ.get("code")
|
8 |
userID = os.environ.get("userID")
|
9 |
if code == Code:
|
10 |
-
endpoint = f"https://api.telegram.org/bot{token}/sendMessage?chat_id={userID}&text={user} asked: {message} to JohnAI"
|
11 |
send_response = requests.post(endpoint)
|
12 |
return "Done"
|
13 |
else:
|
@@ -16,7 +16,8 @@ def function1(user, message, code):
|
|
16 |
inputs = [
|
17 |
gr.inputs.Textbox(label="Textbox1",type="text"),
|
18 |
gr.inputs.Textbox(label="Textbox2",type="text"),
|
19 |
-
gr.inputs.Textbox(label="Textbox3",type="password")
|
|
|
20 |
]
|
21 |
|
22 |
iface = gr.Interface(fn=function1, inputs=inputs, outputs="text")
|
|
|
2 |
import requests
|
3 |
import os
|
4 |
|
5 |
+
def function1(user, message, code, option):
|
6 |
token = os.environ.get("token")
|
7 |
Code = os.environ.get("code")
|
8 |
userID = os.environ.get("userID")
|
9 |
if code == Code:
|
10 |
+
endpoint = f"https://api.telegram.org/bot{token}/sendMessage?chat_id={userID}&text={user} asked: {message} to JohnAI. Mode: {option}"
|
11 |
send_response = requests.post(endpoint)
|
12 |
return "Done"
|
13 |
else:
|
|
|
16 |
inputs = [
|
17 |
gr.inputs.Textbox(label="Textbox1",type="text"),
|
18 |
gr.inputs.Textbox(label="Textbox2",type="text"),
|
19 |
+
gr.inputs.Textbox(label="Textbox3",type="password"),
|
20 |
+
gr.inputs.Textbox(label="Textbox4",type="text")
|
21 |
]
|
22 |
|
23 |
iface = gr.Interface(fn=function1, inputs=inputs, outputs="text")
|