Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,23 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
def
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
iface.launch()
|
|
|
|
| 1 |
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:
|
| 14 |
+
return "Failed"
|
| 15 |
|
| 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=greet, inputs=inputs, outputs="text")
|
| 23 |
iface.launch()
|