reach-vb HF staff commited on
Commit
d42a49e
·
1 Parent(s): 0d68e6c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -0
app.py CHANGED
@@ -17,3 +17,21 @@ async def get_events():
17
  async def webhook(request: Request):
18
  global events
19
  events += [await request.json()]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  async def webhook(request: Request):
18
  global events
19
  events += [await request.json()]
20
+ for event in events:
21
+ page = BeautifulSoup(disc.events[0]._event["data"]["latest"]["raw"])
22
+ image_urls = [link.get('src') for link in page.findAll('img')]
23
+ data = {
24
+ "discussion_number": i,
25
+ "data": {
26
+ "prompt": disc.title,
27
+ "images": image_urls,
28
+ }
29
+ }
30
+ dataset_repo_id = "triple-t/webhook_stable_diffusion_live"
31
+ api = HfApi()
32
+ path = hf_hub_download(repo_id=dataset_repo_id, filename=file_name, cache_dir="/home/patrick_huggingface_co/image_cache", repo_type="dataset")
33
+ api.upload_file(
34
+ path_or_fileobj=path,
35
+ path_in_repo=file_name,
36
+ repo_id=dataset_repo_id,
37
+ repo_type="dataset")