yangheng commited on
Commit
2be5a87
1 Parent(s): ab88106
Files changed (3) hide show
  1. app.py +10 -9
  2. requirements.txt +1 -1
  3. test.py +0 -23
app.py CHANGED
@@ -6,14 +6,15 @@ import PIL.Image
6
  import autocuda
7
  from pyabsa.utils.pyabsa_utils import fprint
8
 
9
- # for z_file in findfile.find_cwd_files(and_key=['.zip'],
10
- # exclude_key=['.ignore', 'git', 'SuperResolutionAnimeDiffusion'],
11
- # recursive=10):
12
- # fprint(f"Extracting {z_file}...")
13
- # with zipfile.ZipFile(z_file, 'r') as zip_ref:
14
- # zip_ref.extractall(os.path.dirname(z_file))
15
-
16
- os.system('unzip random_examples.zip -d random_examples')
 
17
 
18
  from diffusers import (
19
  AutoencoderKL,
@@ -597,4 +598,4 @@ print(f"Space built in {time.time() - start_time:.2f} seconds")
597
 
598
  if not is_colab:
599
  demo.queue(concurrency_count=2)
600
- demo.launch(debug=is_colab, enable_queue=True, share=is_colab)
6
  import autocuda
7
  from pyabsa.utils.pyabsa_utils import fprint
8
 
9
+ try:
10
+ for z_file in findfile.find_cwd_files(and_key=['.zip'],
11
+ exclude_key=['.ignore', 'git', 'SuperResolutionAnimeDiffusion'],
12
+ recursive=10):
13
+ fprint(f"Extracting {z_file}...")
14
+ with zipfile.ZipFile(z_file, 'r') as zip_ref:
15
+ zip_ref.extractall(os.path.dirname(z_file))
16
+ except Exception as e:
17
+ os.system('unzip random_examples.zip')
18
 
19
  from diffusers import (
20
  AutoencoderKL,
598
 
599
  if not is_colab:
600
  demo.queue(concurrency_count=2)
601
+ demo.launch(debug=is_colab, enable_queue=True, share=is_colab)
requirements.txt CHANGED
@@ -4,7 +4,7 @@ torchvision
4
  autocuda
5
  findfile
6
  pyabsa
7
- git+https://github.com/huggingface/diffusers.git
8
  scipy
9
  git+https://github.com/huggingface/transformers.git
10
  ftfy
4
  autocuda
5
  findfile
6
  pyabsa
7
+ diffusers==0.10.0
8
  scipy
9
  git+https://github.com/huggingface/transformers.git
10
  ftfy
test.py DELETED
@@ -1,23 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- # file: test.py
3
- # time: 23:21 2023/1/27
4
- # author: yangheng <hy345@exeter.ac.uk>
5
- # github: https://github.com/yangheng95
6
- # huggingface: https://huggingface.co/yangheng
7
- # google scholar: https://scholar.google.com/citations?user=NPq5a_0AAAAJ&hl=en
8
- # Copyright (C) 2021. All Rights Reserved.
9
-
10
- def fixBadZipfile(zipFile):
11
- f = open(zipFile, 'r+b')
12
- data = f.read()
13
- pos = data.find('\x50\x4b\x05\x06') # End of central directory signature
14
- if (pos > 0):
15
- f.seek(pos + 22) # size of 'ZIP end of central directory record'
16
- f.truncate()
17
- f.close()
18
- else:
19
- pass
20
-
21
-
22
- if __name__ == '__main__':
23
- fixBadZipfile('RealESRGANv030/weights/RealESRGAN_x4plus_anime_6B.zip')