wb-droid commited on
Commit
7eff936
·
1 Parent(s): 798c668

Try again.

Browse files
Files changed (2) hide show
  1. app.py +8 -6
  2. requirements.txt +2 -1
app.py CHANGED
@@ -1,6 +1,7 @@
1
  from fastapi import FastAPI, Request
2
  import gradio as gr
3
- import httpx
 
4
  import os
5
 
6
 
@@ -14,7 +15,7 @@ BASE_URL = f"https://api.telegram.org/bot{TOKEN}"
14
  CUSTOM_PATH = "/gradio"
15
  app = FastAPI()
16
 
17
- client = httpx.AsyncClient()
18
 
19
  @app.get("/")
20
  def read_main():
@@ -30,11 +31,12 @@ async def webhook(req: Request):
30
  chat_id = data['message']['chat']['id']
31
  text = data['message']['text']
32
 
33
- msg = f"{BASE_URL}/sendMessage?chat_id={chat_id}&text={text}"
34
- print(msg)
35
- await client.get(msg)
 
36
 
37
- return data
38
 
39
  def flip_text(x):
40
  return x[::-1]
 
1
  from fastapi import FastAPI, Request
2
  import gradio as gr
3
+ import requests
4
+ #import httpx
5
  import os
6
 
7
 
 
15
  CUSTOM_PATH = "/gradio"
16
  app = FastAPI()
17
 
18
+ #client = httpx.AsyncClient()
19
 
20
  @app.get("/")
21
  def read_main():
 
31
  chat_id = data['message']['chat']['id']
32
  text = data['message']['text']
33
 
34
+ #msg = f"{BASE_URL}/sendMessage?chat_id={chat_id}&text={text}"
35
+ #await client.get(msg)
36
+ response = requests.get(msg)
37
+ print(response)
38
 
39
+ #return data
40
 
41
  def flip_text(x):
42
  return x[::-1]
requirements.txt CHANGED
@@ -1,2 +1,3 @@
1
  gradio
2
- httpx
 
 
1
  gradio
2
+ httpx
3
+ requests