tommy24 commited on
Commit
596b8f0
·
1 Parent(s): 11c104a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -3
app.py CHANGED
@@ -1,7 +1,23 @@
1
  import gradio as gr
 
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
 
 
 
 
 
 
 
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
 
 
 
 
 
 
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()