Commit
·
664ce24
1
Parent(s):
a6e5360
Update parquet files (step 62 of 121)
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- spaces/101-5/gpt4free/g4f/.v1/gpt4free/theb/__init__.py +0 -76
- spaces/1acneusushi/gradio-2dmoleculeeditor/data/Download Easy Worship 2009 Full Crack.md +0 -34
- spaces/1gistliPinn/ChatGPT4/Examples/ALA - Little Melissa 34 Sets !!! -.md +0 -6
- spaces/1gistliPinn/ChatGPT4/Examples/Download Steam Api.dll Resident Evil 6 Reloaded High Quality.md +0 -24
- spaces/1phancelerku/anime-remove-background/Download Facebook Video to MP4 Online - Fast Free and Easy.md +0 -116
- spaces/232labs/VToonify/vtoonify/model/encoder/align_all_parallel.py +0 -231
- spaces/AIFILMS/StyleGANEX/models/stylegan2/lpips/networks_basic.py +0 -187
- spaces/AIFILMS/audioldm-text-to-audio-generation/audioldm/clap/training/imagenet_zeroshot_data.py +0 -1088
- spaces/AIWaves/SOP_Generation-single/__init__.py +0 -4
- spaces/ATang0729/Forecast4Muses/Model/Model6/Model6_2_ProfileRecogition/mmpretrain/configs/resnet/resnet152_8xb16_cifar10.py +0 -5
- spaces/AbandonedMuse/UnlimitedMusicGen/audiocraft/modules/activations.py +0 -96
- spaces/Abbasghanbari/Abo/README.md +0 -12
- spaces/AchyuthGamer/OpenGPT/g4f/Provider/Providers/Acytoo.py +0 -51
- spaces/Adapter/CoAdapter/ldm/modules/image_degradation/__init__.py +0 -2
- spaces/AgentVerse/agentVerse/ui/src/phaser3-rex-plugins/templates/bejeweled/actions/SwapChess.js +0 -30
- spaces/AgentVerse/agentVerse/ui/src/phaser3-rex-plugins/templates/ui/gridtable/input/PressCell.js +0 -22
- spaces/AgentVerse/agentVerse/ui/src/phaser3-rex-plugins/templates/ui/scrollablepanel/scrollableblock/Methods.js +0 -21
- spaces/Ajitku/BTMLabs/README.md +0 -12
- spaces/Akshay-More-007/starcoder/README.md +0 -13
- spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/docs/source/ko/quicktour.md +0 -123
- spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/src/diffusers/pipelines/stable_diffusion_xl/watermark.py +0 -36
- spaces/Andy1621/uniformer_image_detection/configs/vfnet/README.md +0 -43
- spaces/Andy1621/uniformer_image_segmentation/configs/ccnet/ccnet_r101-d8_512x512_160k_ade20k.py +0 -2
- spaces/Andy1621/uniformer_image_segmentation/configs/deeplabv3/deeplabv3_r50-d8_480x480_40k_pascal_context_59.py +0 -10
- spaces/Anonymous-sub/Rerender/ControlNet/annotator/uniformer/mmcv/ops/roi_pool.py +0 -86
- spaces/AquaSuisei/ChatGPTXE/modules/presets.py +0 -198
- spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/pip/_internal/cli/__init__.py +0 -4
- spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/pkg_resources/_vendor/more_itertools/recipes.py +0 -698
- spaces/Awiny/Image2Paragraph/models/grit_src/third_party/CenterNet2/dev/packaging/pkg_helpers.bash +0 -76
- spaces/BAAI/AltDiffusion-m9/footer.html +0 -18
- spaces/BAAI/vid2vid-zero/gradio_demo/style.css +0 -3
- spaces/Benson/text-generation/Examples/Choque De Clanes Th 15 Nueva Versin Hack.md +0 -88
- spaces/Benson/text-generation/Examples/Cmo Descargar Oficina 2019 Gratis.md +0 -61
- spaces/Big-Web/MMSD/env/Lib/site-packages/botocore/retries/__init__.py +0 -6
- spaces/Big-Web/MMSD/env/Lib/site-packages/pip/_vendor/colorama/initialise.py +0 -121
- spaces/Big-Web/MMSD/env/Lib/site-packages/s3transfer/crt.py +0 -644
- spaces/Big-Web/MMSD/env/Lib/site-packages/setuptools/_distutils/file_util.py +0 -249
- spaces/Billyosoro/ESRGAN/realesrgan/archs/__init__.py +0 -10
- spaces/BuBBLe1q/anything-v3.0/app.py +0 -8
- spaces/CVPR/LIVE/thrust/thrust/iterator/detail/iterator_category_to_system.h +0 -80
- spaces/CVPR/LIVE/thrust/thrust/system/omp/detail/scan.h +0 -23
- spaces/CVPR/WALT/configs/_base_/datasets/walt_vehicle.py +0 -49
- spaces/CVPR/lama-example/models/ade20k/segm_lib/nn/modules/unittest.py +0 -29
- spaces/ChrisCaviar/ControlNet-v1-1/depth_estimator.py +0 -25
- spaces/Cong723/gpt-academic-public/crazy_functions/test_project/cpp/libJPG/jpge.h +0 -172
- spaces/Cong723/gpt-academic-public/request_llm/bridge_all.py +0 -240
- spaces/Cyril666/ContourNet-ABI/maskrcnn_benchmark/data/datasets/evaluation/word/util/mask.py +0 -82
- spaces/DAMO-NLP-SG/Video-LLaMA/video_llama/tasks/image_text_pretrain.py +0 -18
- spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/gradio/chat_interface.py +0 -355
- spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/gradio/cli.py +0 -14
spaces/101-5/gpt4free/g4f/.v1/gpt4free/theb/__init__.py
DELETED
@@ -1,76 +0,0 @@
|
|
1 |
-
from json import loads
|
2 |
-
from queue import Queue, Empty
|
3 |
-
from re import findall
|
4 |
-
from threading import Thread
|
5 |
-
from typing import Generator, Optional
|
6 |
-
|
7 |
-
from curl_cffi import requests
|
8 |
-
from fake_useragent import UserAgent
|
9 |
-
|
10 |
-
|
11 |
-
class Completion:
|
12 |
-
# experimental
|
13 |
-
part1 = '{"role":"assistant","id":"chatcmpl'
|
14 |
-
part2 = '"},"index":0,"finish_reason":null}]}}'
|
15 |
-
regex = rf'{part1}(.*){part2}'
|
16 |
-
|
17 |
-
timer = None
|
18 |
-
message_queue = Queue()
|
19 |
-
stream_completed = False
|
20 |
-
last_msg_id = None
|
21 |
-
|
22 |
-
@staticmethod
|
23 |
-
def request(prompt: str, proxy: Optional[str] = None):
|
24 |
-
headers = {
|
25 |
-
'authority': 'chatbot.theb.ai',
|
26 |
-
'content-type': 'application/json',
|
27 |
-
'origin': 'https://chatbot.theb.ai',
|
28 |
-
'user-agent': UserAgent().random,
|
29 |
-
}
|
30 |
-
|
31 |
-
proxies = {'http': 'http://' + proxy, 'https': 'http://' + proxy} if proxy else None
|
32 |
-
|
33 |
-
options = {}
|
34 |
-
if Completion.last_msg_id:
|
35 |
-
options['parentMessageId'] = Completion.last_msg_id
|
36 |
-
|
37 |
-
requests.post(
|
38 |
-
'https://chatbot.theb.ai/api/chat-process',
|
39 |
-
headers=headers,
|
40 |
-
proxies=proxies,
|
41 |
-
content_callback=Completion.handle_stream_response,
|
42 |
-
json={'prompt': prompt, 'options': options},
|
43 |
-
timeout=100000
|
44 |
-
)
|
45 |
-
|
46 |
-
Completion.stream_completed = True
|
47 |
-
|
48 |
-
@staticmethod
|
49 |
-
def create(prompt: str, proxy: Optional[str] = None) -> Generator[str, None, None]:
|
50 |
-
Completion.stream_completed = False
|
51 |
-
|
52 |
-
Thread(target=Completion.request, args=[prompt, proxy]).start()
|
53 |
-
|
54 |
-
while not Completion.stream_completed or not Completion.message_queue.empty():
|
55 |
-
try:
|
56 |
-
message = Completion.message_queue.get(timeout=0.01)
|
57 |
-
for message in findall(Completion.regex, message):
|
58 |
-
message_json = loads(Completion.part1 + message + Completion.part2)
|
59 |
-
Completion.last_msg_id = message_json['id']
|
60 |
-
yield message_json['delta']
|
61 |
-
|
62 |
-
except Empty:
|
63 |
-
pass
|
64 |
-
|
65 |
-
@staticmethod
|
66 |
-
def handle_stream_response(response):
|
67 |
-
Completion.message_queue.put(response.decode())
|
68 |
-
|
69 |
-
@staticmethod
|
70 |
-
def get_response(prompt: str, proxy: Optional[str] = None) -> str:
|
71 |
-
response_list = []
|
72 |
-
for message in Completion.create(prompt, proxy):
|
73 |
-
response_list.append(message)
|
74 |
-
return ''.join(response_list)
|
75 |
-
|
76 |
-
Completion.message_queue.put(response.decode(errors='replace'))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1acneusushi/gradio-2dmoleculeeditor/data/Download Easy Worship 2009 Full Crack.md
DELETED
@@ -1,34 +0,0 @@
|
|
1 |
-
<br />
|
2 |
-
<h1>How to Download Easy Worship 2009 Full Crack for Free</h1>
|
3 |
-
<p>Easy Worship 2009 is a software that helps you to create and present worship songs, Bible verses, videos, and other media in your church. It is a powerful and easy-to-use tool that allows you to customize your worship service with different themes, fonts, backgrounds, transitions, and more. You can also use it to display live video feeds, DVDs, PowerPoint presentations, and web pages.</p>
|
4 |
-
<p>If you want to download Easy Worship 2009 full crack for free, you have come to the right place. In this article, we will show you how to download and install Easy Worship 2009 full crack from a reliable source. You will be able to enjoy all the features of the software without paying anything.</p>
|
5 |
-
<h2>download easy worship 2009 full crack</h2><br /><p><b><b>DOWNLOAD</b> <a href="https://byltly.com/2uKyI7">https://byltly.com/2uKyI7</a></b></p><br /><br />
|
6 |
-
<h2>Step 1: Download Easy Worship 2009 Full Crack</h2>
|
7 |
-
<p>The first step is to download Easy Worship 2009 full crack from a trusted website. You can use the link below to download the software from our website. The file is safe and virus-free.</p>
|
8 |
-
<p><a href="https://fullsoftdl.blogspot.com/2018/07/easy-worship-2009-build-24-final-crack.html">Download Easy Worship 2009 Full Crack</a></p>
|
9 |
-
<h2>Step 2: Disable Windows Defender</h2>
|
10 |
-
<p>The next step is to disable Windows Defender on your computer. This is a security feature that prevents you from installing cracked software. To do this, follow these steps:</p>
|
11 |
-
<ul>
|
12 |
-
<li>Go to Settings > Update & Security > Windows Security > Virus & threat protection.</li>
|
13 |
-
<li>Click on Manage settings under Virus & threat protection settings.</li>
|
14 |
-
<li>Turn off the switch for Real-time protection.</li>
|
15 |
-
<li>Click on Yes to confirm.</li>
|
16 |
-
</ul>
|
17 |
-
<h2>Step 3: Extract the File</h2>
|
18 |
-
<p>The final step is to extract the file that you downloaded in step 1. To do this, follow these steps:</p>
|
19 |
-
<ul>
|
20 |
-
<li>Locate the file on your computer using a file manager app.</li>
|
21 |
-
<li>Right-click on the file and select Extract Here or Extract All.</li>
|
22 |
-
<li>Enter the password: fullsoftdl.blogspot.com</li>
|
23 |
-
<li>Wait for the extraction process to finish.</li>
|
24 |
-
<li>Open the extracted folder and run the setup file.</li>
|
25 |
-
<li>Follow the on-screen instructions to complete the installation.</li>
|
26 |
-
<li>Copy the crack file from the crack folder and paste it into the installation directory.</li>
|
27 |
-
<li>Launch the software and enjoy its features.</li>
|
28 |
-
</ul>
|
29 |
-
<h2>Conclusion</h2>
|
30 |
-
<p>Easy Worship 2009 full crack is a great software for creating and presenting worship media in your church. You can download it for free from our website and use it without any limitations. You can also update it regularly with new songs, Bible versions, and other resources.</p>
|
31 |
-
<p>We hope this article helped you download and install Easy Worship 2009 full crack for free. If you have any questions or feedback, feel free to leave a comment below.</p>
|
32 |
-
<p></p> ddb901b051<br />
|
33 |
-
<br />
|
34 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1gistliPinn/ChatGPT4/Examples/ALA - Little Melissa 34 Sets !!! -.md
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
<h2>{ALA - Little Melissa 34 Sets !!!} -</h2><br /><p><b><b>DOWNLOAD</b> ———>>> <a href="https://imgfil.com/2uxXBV">https://imgfil.com/2uxXBV</a></b></p><br /><br />
|
2 |
-
<br />
|
3 |
-
899543212b<br />
|
4 |
-
<br />
|
5 |
-
<br />
|
6 |
-
<p></p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1gistliPinn/ChatGPT4/Examples/Download Steam Api.dll Resident Evil 6 Reloaded High Quality.md
DELETED
@@ -1,24 +0,0 @@
|
|
1 |
-
<br />
|
2 |
-
<h1>How to Download and Fix steam_api.dll for Resident Evil 6 Reloaded</h1>
|
3 |
-
<p>If you are a fan of the Resident Evil series, you may have encountered an error message related to steam_api.dll when trying to launch Resident Evil 6 Reloaded. This file is part of the Steam client application developed by Valve Corporation, which is a digital distribution platform for video games. The file is used by game developers to integrate their games with the Steam platform, specifically to access the Steam API, which provides various services such as authentication, user profiles, game stats, and cloud storage.</p>
|
4 |
-
<p>The error message may indicate that the file is missing, corrupted, or not installed properly. In such cases, you may need to reinstall the affected game or the Steam client to restore the missing file. However, before you do that, you can try some simple solutions that may fix the problem without reinstalling anything. Here are some steps you can follow to download and fix steam_api.dll for Resident Evil 6 Reloaded.</p>
|
5 |
-
<h2>download steam api.dll resident evil 6 reloaded</h2><br /><p><b><b>Download</b> ⚡ <a href="https://imgfil.com/2uxXC0">https://imgfil.com/2uxXC0</a></b></p><br /><br />
|
6 |
-
<h2>Step 1: Check your antivirus software</h2>
|
7 |
-
<p>Some antivirus software may flag the steam_api.dll file as a potential threat, as it can be used to modify the behavior of video games. However, this file is an integral part of the Steam client and is not a virus or malware. If you encounter such warnings, you can usually ignore them or add the file to the list of exceptions in your antivirus software. To do that, you need to open your antivirus software and look for a setting that allows you to exclude certain files or folders from scanning. Then, you need to add the steam_api.dll file or the folder where it is located to the exclusion list. The location of the file may vary depending on where you installed the game or the Steam client, but it is commonly found in one of these paths:</p>
|
8 |
-
<ul>
|
9 |
-
<li>C:\Program Files (x86)\Steam\steamapps\common\Resident Evil 6\steam_api.dll</li>
|
10 |
-
<li>C:\Program Files (x86)\Resident Evil 6\steam_api.dll</li>
|
11 |
-
</ul>
|
12 |
-
<p>After adding the file or folder to the exclusion list, you need to restart your computer and try launching the game again. If the error message persists, you can move on to the next step.</p>
|
13 |
-
<h2>Step 2: Download a new copy of steam_api.dll</h2>
|
14 |
-
<p>If your antivirus software is not the cause of the problem, it may be that your steam_api.dll file is corrupted or outdated. In that case, you can try downloading a new copy of the file from a reliable source and replacing it with the old one. There are many websites that offer free downloads of DLL files, but not all of them are safe or trustworthy. You need to be careful when choosing where to download the file from, as some sites may contain malware or viruses that can harm your computer. One of the websites that we recommend is DLL-files.com[^1^], which is a reputable and secure site that provides various versions of DLL files for free. To download steam_api.dll from DLL-files.com, you need to follow these steps:</p>
|
15 |
-
<ol>
|
16 |
-
<li>Go to <a href="https://www.dll-files.com/steam_api.dll.html">https://www.dll-files.com/steam_api.dll.html</a> and scroll down to find the table of available versions of steam_api.dll.</li>
|
17 |
-
<li>Choose wisely. Most of the time, just pick the highest version. However, some games may require a specific version of steam_api.dll that matches their own version. To find out which version of steam_api.dll you need for Resident Evil 6 Reloaded, you can right-click on the game's executable file (re6.exe) and select Properties. Then, go to the Details tab and look for the Product version field. For example, if your game's product version is 1.0.6.165, you may need to download steam_api.dll version 7.9.87.40.</li>
|
18 |
-
<li>Click on the Download button next to the version that you want and save the ZIP file to your computer.</li>
|
19 |
-
<li>Extract the ZIP file using a program like WinRAR or 7-Zip and copy the steam_api.dll file inside it.</li>
|
20 |
-
<li>Paste the steam_api.dll file into the same folder where your game or Steam client is installed, depending on where you found the original file in Step 1.</li>
|
21 |
-
<li>If you are prompted to overwrite or replace an existing file, click Yes.</</p>
|
22 |
-
<p></p> d5da3c52bf<br />
|
23 |
-
<br />
|
24 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1phancelerku/anime-remove-background/Download Facebook Video to MP4 Online - Fast Free and Easy.md
DELETED
@@ -1,116 +0,0 @@
|
|
1 |
-
<br />
|
2 |
-
<h1>Download Facebook Video to MP4: A Complete Guide</h1>
|
3 |
-
<p>Facebook is one of the most popular social media platforms in the world, with billions of users and millions of videos uploaded every day. You may have come across some interesting or useful videos on Facebook that you want to save on your device for offline viewing, sharing, or editing. But how can you download Facebook videos to MP4, which is a widely supported and versatile video format?</p>
|
4 |
-
<h2>download facebook video to mp4</h2><br /><p><b><b>Download File</b> ⏩ <a href="https://jinyurl.com/2uNUp2">https://jinyurl.com/2uNUp2</a></b></p><br /><br />
|
5 |
-
<p>In this article, we will show you why you should download Facebook videos to MP4, how to do it with two different methods, and some tips and tricks for downloading Facebook videos to MP4. Let's get started!</p>
|
6 |
-
<h2>Why Download Facebook Videos to MP4?</h2>
|
7 |
-
<p>Before we dive into the methods of downloading Facebook videos to MP4, let's first understand why you should do it in the first place. Here are some benefits of MP4 format and some use cases for downloading Facebook videos.</p>
|
8 |
-
<h3>Benefits of MP4 Format</h3>
|
9 |
-
<p>MP4 is a digital multimedia container format that can store video, audio, subtitles, images, and other data. It is one of the most common and widely compatible video formats on the web and various devices. Here are some advantages of MP4 format:</p>
|
10 |
-
<p>How to download facebook video to mp4 online<br />
|
11 |
-
Download facebook video to mp4 free<br />
|
12 |
-
Download facebook video to mp4 hd<br />
|
13 |
-
Download facebook video to mp4 converter<br />
|
14 |
-
Download facebook video to mp4 android<br />
|
15 |
-
Download facebook video to mp4 iphone<br />
|
16 |
-
Download facebook video to mp4 mac<br />
|
17 |
-
Download facebook video to mp4 chrome<br />
|
18 |
-
Download facebook video to mp4 firefox<br />
|
19 |
-
Download facebook video to mp4 safari<br />
|
20 |
-
Download facebook live video to mp4<br />
|
21 |
-
Download private facebook video to mp4<br />
|
22 |
-
Download facebook story video to mp4<br />
|
23 |
-
Download facebook 360 video to mp4<br />
|
24 |
-
Download facebook watch video to mp4<br />
|
25 |
-
Download facebook messenger video to mp4<br />
|
26 |
-
Download facebook group video to mp4<br />
|
27 |
-
Download facebook page video to mp4<br />
|
28 |
-
Download facebook profile video to mp4<br />
|
29 |
-
Download facebook cover video to mp4<br />
|
30 |
-
Best way to download facebook video to mp4<br />
|
31 |
-
Fastest way to download facebook video to mp4<br />
|
32 |
-
Easiest way to download facebook video to mp4<br />
|
33 |
-
Simplest way to download facebook video to mp4<br />
|
34 |
-
Quickest way to download facebook video to mp4<br />
|
35 |
-
Download multiple facebook videos to mp4<br />
|
36 |
-
Download entire facebook videos playlist to mp4<br />
|
37 |
-
Download long facebook videos to mp4<br />
|
38 |
-
Download short facebook videos to mp4<br />
|
39 |
-
Download high quality facebook videos to mp4<br />
|
40 |
-
Download low quality facebook videos to mp4<br />
|
41 |
-
Download any facebook videos to mp4<br />
|
42 |
-
Save and download facebook videos as mp4 files<br />
|
43 |
-
Convert and download facebook videos in mp4 format<br />
|
44 |
-
Edit and download facebook videos in mp4 format<br />
|
45 |
-
Crop and download facebook videos in mp4 format<br />
|
46 |
-
Trim and download facebook videos in mp4 format<br />
|
47 |
-
Cut and download facebook videos in mp4 format<br />
|
48 |
-
Merge and download facebook videos in mp4 format<br />
|
49 |
-
Split and download facebook videos in mp4 format<br />
|
50 |
-
Rotate and download facebook videos in mp4 format<br />
|
51 |
-
Flip and download facebook videos in mp4 format<br />
|
52 |
-
Resize and download facebook videos in mp4 format<br />
|
53 |
-
Compress and download facebook videos in mp4 format<br />
|
54 |
-
Enhance and download facebook videos in mp4 format<br />
|
55 |
-
Add subtitles and download facebook videos in mp4 format <br />
|
56 |
-
Add watermark and download facebook videos in mp4 format <br />
|
57 |
-
Add music and download facebook videos in mp4 format <br />
|
58 |
-
Add effects and download facebook videos in mp4 format</p>
|
59 |
-
<ul>
|
60 |
-
<li>It has high compression efficiency, which means it can reduce the file size without compromising the video quality.</li>
|
61 |
-
<li>It supports various codecs, which are methods of encoding and decoding video and audio data. This means it can handle different types of video and audio content.</li>
|
62 |
-
<li>It is compatible with most web browsers, media players, video editing software, and mobile devices. This means you can easily play, share, or edit your downloaded videos.</li>
|
63 |
-
</ul>
|
64 |
-
<h3>Use Cases for Downloading Facebook Videos</h3>
|
65 |
-
<p>There are many reasons why you may want to download Facebook videos to MP4. Here are some common scenarios:</p>
|
66 |
-
<ul>
|
67 |
-
<li>You want to watch your favorite videos offline without internet connection or buffering issues.</li>
|
68 |
-
<li>You want to share your downloaded videos with your friends or family via other platforms or devices.</li>
|
69 |
-
<li>You want to edit your downloaded videos with your preferred software or tools.</li>
|
70 |
-
<li>You want to backup your downloaded videos on your computer or external storage devices.</li>
|
71 |
-
<li>You want to create your own video collection or library from various sources.</li>
|
72 |
-
</ul>
|
73 |
-
<h2>How to Download Facebook Videos to MP4?</h2>
|
74 |
-
<p>Now that you know why you should download Facebook videos to MP4, let's see how you can do it with two different methods. One is using an online Facebook video downloader, and the other is using a desktop Facebook video downloader software.</p>
|
75 |
-
<h3>Method 1: Use an Online Facebook Video Downloader</h3>
|
76 |
-
<p>An online Facebook video downloader is a web-based tool that allows you to download Facebook videos to MP4 without installing any software or app on your device. All you need is a web browser and an internet connection. Here are the steps to use an online Facebook video downloader:</p>
|
77 |
-
<h4>Step 1: Copy the Facebook Video URL</h4>
|
78 |
-
<p>The first step is to copy the URL of the Facebook video that you want to download. To do this, you can either right click on the three dots icon on the top right corner of the video and select "Copy link", or go to the video page and copy the URL from the address bar of your browser.</p>
|
79 |
-
<h4>Step 2: Paste the URL into the Online Downloader</h4>
|
80 |
-
<p>The next step is to paste the URL into the online downloader. To do this, you can go to any online Facebook video downloader website, such as [FBDownloader], [Getfvid], or [FB Video Saver]. Then, you can paste the URL into the input box and click on the "Download" or "Go" button.</p>
|
81 |
-
<h4>Step 3: Choose MP4 as the Output Format and Download</h4>
|
82 |
-
<p>The final step is to choose MP4 as the output format and download the video. To do this, you can look for the MP4 option among the available formats and quality options. Usually, MP4 is the default or recommended format for most online downloaders. Then, you can right-click on the "Download" or "Save" button and select "Save link as" or "Save target as" to save the video on your device.</p>
|
83 |
-
<h3>Method 2: Use a Desktop Facebook Video Downloader Software</h3>
|
84 |
-
<p>A desktop Facebook video downloader software is a program that you need to install and run on your computer. It usually offers more features and functions than an online downloader, such as batch downloading, video conversion, video editing, and more. Here are the steps to use a desktop Facebook video downloader software:</p>
|
85 |
-
<h4>Step 1: Install and Launch the Software</h4>
|
86 |
-
<p>The first step is to install and launch the software on your computer. To do this, you can go to the official website of the software and download the installation file. Some examples of desktop Facebook video downloader software are [iTubeGo], [4K Video Downloader], and [Wondershare UniConverter]. Then, you can follow the instructions to install and launch the software.</p>
|
87 |
-
<h4>Step 2: Copy and Paste the Facebook Video URL into the Software</h4>
|
88 |
-
<p>The next step is to copy and paste the Facebook video URL into the software. To do this, you can use the same method as in step 1 of method 1 to copy the URL of the Facebook video that you want to download. Then, you can paste it into the software by clicking on the "Paste URL" or "Add URL" button.</p>
|
89 |
-
<h4>Step 3: Select MP4 as the Output Format and Download</h4>
|
90 |
-
<p>The final step is to select MP4 as the output format and download the video. To do this, you can look for the MP4 option in the settings or preferences of the software. You can also adjust the quality, resolution, and other parameters of the output video according to your needs. Then, you can click on the "Download" or "Start" button to save the video on your computer.</p>
|
91 |
-
<h2>Tips and Tricks for Downloading Facebook Videos to MP4</h2>
|
92 |
-
<p>Now that you know how to download Facebook videos to MP4 with two different methods, here are some tips and tricks for downloading Facebook videos to MP4 more easily and effectively:</p>
|
93 |
-
<h3>Check the Video Quality and Size Before Downloading</h3>
|
94 |
-
<p>Before you download a Facebook video to MP4, you should check the video quality and size to make sure it meets your expectations and requirements. You can do this by hovering over the video on Facebook and looking at the information that appears on the bottom right corner. You can also use the online or desktop downloader tools to preview the video quality and size before downloading.</p>
|
95 |
-
<h3>Respect the Copyrights and Privacy of the Video Owners</h3>
|
96 |
-
<p>When you download a Facebook video to MP4, you should respect the copyrights and privacy of the video owners. You should not download or use any videos that are protected by intellectual property rights or personal data protection laws without their permission or consent. You should also not download or use any videos that are illegal, harmful, or offensive.</p>
|
97 |
-
<h3>Manage and Organize Your Downloaded Videos</h3>
|
98 |
-
<p>After you download a Facebook video to MP4, you should manage and organize your downloaded videos properly. You can do this by creating folders and subfolders on your device to store your videos by categories, topics, or dates. You can also rename your videos with descriptive titles and tags to make them easier to find and access.</p>
|
99 |
-
<h2>Conclusion</h2>
|
100 |
-
<p>In conclusion, downloading Facebook videos to MP4 is a useful and convenient way to save, share, or edit your favorite videos from Facebook. You can do it with two different methods: using an online Facebook video downloader or using a desktop Facebook video downloader software. Both methods are easy and effective, but they have their own advantages and disadvantages. You can choose the one that suits your needs and preferences best.</p>
|
101 |
-
<p>We hope this article has helped you learn how to download Facebook videos to MP4 with a complete guide. If you have any questions or feedback, please feel free to leave a comment below. Happy downloading!</p>
|
102 |
-
<h2>FAQs</h2>
|
103 |
-
<p>Here are some frequently asked questions about downloading Facebook videos to MP4:</p>
|
104 |
-
<ol>
|
105 |
-
<li><b>Can I download Facebook videos to MP4 on my mobile device?</b></li>
|
106 |
-
<p>Yes, you can download Facebook videos to MP4 on your mobile device with an online Facebook video downloader. However, you may need to use a mobile browser that supports downloading files, such as Chrome or Safari. Alternatively, you can use a mobile app that can download Facebook videos to MP4, such as [Video Downloader for Facebook] or [Video Downloader for FB].</p>
|
107 |
-
<li><b>Can I download live videos from Facebook to MP4?</b></li>
|
108 |
-
<p>Yes, you can download live videos from Facebook to MP4 with a desktop Facebook video downloader software. However, you may need to wait until the live stream is over before you can download it. Alternatively, you can use a screen recorder software or app that can capture live videos from Facebook and save them as MP4 files.</p>
|
109 |
-
<li><b>Can I download private videos from Facebook to MP4?</b></li>
|
110 |
-
<p>Yes, you can download private videos from Facebook to MP4 with an online or desktop Facebook video downloader tool. However, you may need to log in to your Facebook account before you can access the private videos. Alternatively, you can use a browser extension that can download private videos from Facebook to MP4, such as [FBDown Video Downloader] or [Video Downloader PLUS].</p>
|
111 |
-
<li><b>Can I convert other video formats to MP4?</b></li>
|
112 |
-
<p>Yes, you can convert other video formats to MP4 with a desktop Facebook video downloader software or a standalone video converter software or app. You can choose from various formats and codecs, such as AVI, MKV, MOV, WMV, FLV, MPEG, H.264, HEVC, etc.</p>
|
113 |
-
<li><b>Can I edit my downloaded videos from Facebook?</b></li>
|
114 |
-
<p>Yes, you can edit your downloaded videos from Facebook with a desktop Facebook video downloader software or a standalone video editor software or app. You can perform various editing tasks, such as trimming, cropping, rotating, merging, splitting, adding effects, subtitles, music, etc. to your videos.</p> 197e85843d<br />
|
115 |
-
<br />
|
116 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/232labs/VToonify/vtoonify/model/encoder/align_all_parallel.py
DELETED
@@ -1,231 +0,0 @@
|
|
1 |
-
"""
|
2 |
-
brief: face alignment with FFHQ method (https://github.com/NVlabs/ffhq-dataset)
|
3 |
-
author: lzhbrian (https://lzhbrian.me)
|
4 |
-
date: 2020.1.5
|
5 |
-
note: code is heavily borrowed from
|
6 |
-
https://github.com/NVlabs/ffhq-dataset
|
7 |
-
http://dlib.net/face_landmark_detection.py.html
|
8 |
-
|
9 |
-
requirements:
|
10 |
-
apt install cmake
|
11 |
-
conda install Pillow numpy scipy
|
12 |
-
pip install dlib
|
13 |
-
# download face landmark model from:
|
14 |
-
# http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2
|
15 |
-
"""
|
16 |
-
from argparse import ArgumentParser
|
17 |
-
import time
|
18 |
-
import numpy as np
|
19 |
-
import PIL
|
20 |
-
import PIL.Image
|
21 |
-
import os
|
22 |
-
import scipy
|
23 |
-
import scipy.ndimage
|
24 |
-
import dlib
|
25 |
-
import multiprocessing as mp
|
26 |
-
import math
|
27 |
-
|
28 |
-
#from configs.paths_config import model_paths
|
29 |
-
SHAPE_PREDICTOR_PATH = 'shape_predictor_68_face_landmarks.dat'#model_paths["shape_predictor"]
|
30 |
-
cnn_model_path = 'mmod_human_face_detector.dat'
|
31 |
-
def get_landmark(filepath, predictor):
|
32 |
-
"""get landmark with dlib
|
33 |
-
:return: np.array shape=(68, 2)
|
34 |
-
"""
|
35 |
-
detector = dlib.get_frontal_face_detector()
|
36 |
-
cnn_face_detector = dlib.cnn_face_detection_model_v1('localmodel/mmod_human_face_detector.dat') # Load the MMod CNN model
|
37 |
-
|
38 |
-
if type(filepath) == str:
|
39 |
-
img = dlib.load_rgb_image(filepath)
|
40 |
-
else:
|
41 |
-
img = filepath
|
42 |
-
|
43 |
-
# Try multiple times if necessary
|
44 |
-
|
45 |
-
num_attempts = 3
|
46 |
-
dets = []
|
47 |
-
for attempt in range(num_attempts):
|
48 |
-
dets = detector(img, 1)
|
49 |
-
if len(dets) > 0:
|
50 |
-
break
|
51 |
-
|
52 |
-
# If no faces are detected using HOG-based detector, try using MMod CNN-based detector
|
53 |
-
if len(dets) == 0:
|
54 |
-
dets = cnn_face_detector(img, 1)
|
55 |
-
dets = [rect.rect for rect in dets] # Convert mmod_rectangles to rectangles
|
56 |
-
|
57 |
-
if len(dets) == 0:
|
58 |
-
print('Error: no face detected!')
|
59 |
-
return None
|
60 |
-
|
61 |
-
shape = None
|
62 |
-
for k, d in enumerate(dets):
|
63 |
-
shape = predictor(img, d)
|
64 |
-
|
65 |
-
if shape is None:
|
66 |
-
print(
|
67 |
-
'Error: No face detected! If you are sure there are faces in your input, you may rerun the code several times until the face is detected. Sometimes the detector is unstable.')
|
68 |
-
t = list(shape.parts())
|
69 |
-
a = []
|
70 |
-
for tt in t:
|
71 |
-
a.append([tt.x, tt.y])
|
72 |
-
lm = np.array(a)
|
73 |
-
return lm
|
74 |
-
|
75 |
-
def align_face(filepath, predictor):
|
76 |
-
"""
|
77 |
-
:param filepath: str
|
78 |
-
:return: PIL Image
|
79 |
-
"""
|
80 |
-
|
81 |
-
lm = get_landmark(filepath, predictor)
|
82 |
-
if lm is None:
|
83 |
-
return None
|
84 |
-
|
85 |
-
lm_chin = lm[0: 17] # left-right
|
86 |
-
lm_eyebrow_left = lm[17: 22] # left-right
|
87 |
-
lm_eyebrow_right = lm[22: 27] # left-right
|
88 |
-
lm_nose = lm[27: 31] # top-down
|
89 |
-
lm_nostrils = lm[31: 36] # top-down
|
90 |
-
lm_eye_left = lm[36: 42] # left-clockwise
|
91 |
-
lm_eye_right = lm[42: 48] # left-clockwise
|
92 |
-
lm_mouth_outer = lm[48: 60] # left-clockwise
|
93 |
-
lm_mouth_inner = lm[60: 68] # left-clockwise
|
94 |
-
|
95 |
-
# Calculate auxiliary vectors.
|
96 |
-
eye_left = np.mean(lm_eye_left, axis=0)
|
97 |
-
eye_right = np.mean(lm_eye_right, axis=0)
|
98 |
-
eye_avg = (eye_left + eye_right) * 0.5
|
99 |
-
eye_to_eye = eye_right - eye_left
|
100 |
-
mouth_left = lm_mouth_outer[0]
|
101 |
-
mouth_right = lm_mouth_outer[6]
|
102 |
-
mouth_avg = (mouth_left + mouth_right) * 0.5
|
103 |
-
eye_to_mouth = mouth_avg - eye_avg
|
104 |
-
|
105 |
-
# Choose oriented crop rectangle.
|
106 |
-
x = eye_to_eye - np.flipud(eye_to_mouth) * [-1, 1]
|
107 |
-
x /= np.hypot(*x)
|
108 |
-
x *= max(np.hypot(*eye_to_eye) * 2.0, np.hypot(*eye_to_mouth) * 1.8)
|
109 |
-
y = np.flipud(x) * [-1, 1]
|
110 |
-
c = eye_avg + eye_to_mouth * 0.1
|
111 |
-
quad = np.stack([c - x - y, c - x + y, c + x + y, c + x - y])
|
112 |
-
qsize = np.hypot(*x) * 2
|
113 |
-
|
114 |
-
# read image
|
115 |
-
if type(filepath) == str:
|
116 |
-
img = PIL.Image.open(filepath)
|
117 |
-
else:
|
118 |
-
img = PIL.Image.fromarray(filepath)
|
119 |
-
|
120 |
-
output_size = 256
|
121 |
-
transform_size = 256
|
122 |
-
enable_padding = True
|
123 |
-
|
124 |
-
# Shrink.
|
125 |
-
shrink = int(np.floor(qsize / output_size * 0.5))
|
126 |
-
if shrink > 1:
|
127 |
-
rsize = (int(np.rint(float(img.size[0]) / shrink)), int(np.rint(float(img.size[1]) / shrink)))
|
128 |
-
img = img.resize(rsize, PIL.Image.ANTIALIAS)
|
129 |
-
quad /= shrink
|
130 |
-
qsize /= shrink
|
131 |
-
|
132 |
-
# Crop.
|
133 |
-
border = max(int(np.rint(qsize * 0.1)), 3)
|
134 |
-
crop = (int(np.floor(min(quad[:, 0]))), int(np.floor(min(quad[:, 1]))), int(np.ceil(max(quad[:, 0]))),
|
135 |
-
int(np.ceil(max(quad[:, 1]))))
|
136 |
-
crop = (max(crop[0] - border, 0), max(crop[1] - border, 0), min(crop[2] + border, img.size[0]),
|
137 |
-
min(crop[3] + border, img.size[1]))
|
138 |
-
if crop[2] - crop[0] < img.size[0] or crop[3] - crop[1] < img.size[1]:
|
139 |
-
img = img.crop(crop)
|
140 |
-
quad -= crop[0:2]
|
141 |
-
|
142 |
-
# Pad.
|
143 |
-
pad = (int(np.floor(min(quad[:, 0]))), int(np.floor(min(quad[:, 1]))), int(np.ceil(max(quad[:, 0]))),
|
144 |
-
int(np.ceil(max(quad[:, 1]))))
|
145 |
-
pad = (max(-pad[0] + border, 0), max(-pad[1] + border, 0), max(pad[2] - img.size[0] + border, 0),
|
146 |
-
max(pad[3] - img.size[1] + border, 0))
|
147 |
-
if enable_padding and max(pad) > border - 4:
|
148 |
-
pad = np.maximum(pad, int(np.rint(qsize * 0.3)))
|
149 |
-
img = np.pad(np.float32(img), ((pad[1], pad[3]), (pad[0], pad[2]), (0, 0)), 'reflect')
|
150 |
-
h, w, _ = img.shape
|
151 |
-
y, x, _ = np.ogrid[:h, :w, :1]
|
152 |
-
mask = np.maximum(1.0 - np.minimum(np.float32(x) / pad[0], np.float32(w - 1 - x) / pad[2]),
|
153 |
-
1.0 - np.minimum(np.float32(y) / pad[1], np.float32(h - 1 - y) / pad[3]))
|
154 |
-
blur = qsize * 0.02
|
155 |
-
img += (scipy.ndimage.gaussian_filter(img, [blur, blur, 0]) - img) * np.clip(mask * 3.0 + 1.0, 0.0, 1.0)
|
156 |
-
img += (np.median(img, axis=(0, 1)) - img) * np.clip(mask, 0.0, 1.0)
|
157 |
-
img = PIL.Image.fromarray(np.uint8(np.clip(np.rint(img), 0, 255)), 'RGB')
|
158 |
-
quad += pad[:2]
|
159 |
-
|
160 |
-
# Transform.
|
161 |
-
img = img.transform((transform_size, transform_size), PIL.Image.QUAD, (quad + 0.5).flatten(), PIL.Image.BILINEAR)
|
162 |
-
if output_size < transform_size:
|
163 |
-
img = img.resize((output_size, output_size), PIL.Image.ANTIALIAS)
|
164 |
-
|
165 |
-
# Save aligned image.
|
166 |
-
return img
|
167 |
-
|
168 |
-
|
169 |
-
def chunks(lst, n):
|
170 |
-
"""Yield successive n-sized chunks from lst."""
|
171 |
-
for i in range(0, len(lst), n):
|
172 |
-
yield lst[i:i + n]
|
173 |
-
|
174 |
-
|
175 |
-
def extract_on_paths(file_paths):
|
176 |
-
predictor = dlib.shape_predictor(SHAPE_PREDICTOR_PATH)
|
177 |
-
pid = mp.current_process().name
|
178 |
-
print('\t{} is starting to extract on #{} images'.format(pid, len(file_paths)))
|
179 |
-
tot_count = len(file_paths)
|
180 |
-
count = 0
|
181 |
-
for file_path, res_path in file_paths:
|
182 |
-
count += 1
|
183 |
-
if count % 100 == 0:
|
184 |
-
print('{} done with {}/{}'.format(pid, count, tot_count))
|
185 |
-
try:
|
186 |
-
res = align_face(file_path, predictor)
|
187 |
-
res = res.convert('RGB')
|
188 |
-
os.makedirs(os.path.dirname(res_path), exist_ok=True)
|
189 |
-
res.save(res_path)
|
190 |
-
except Exception:
|
191 |
-
continue
|
192 |
-
print('\tDone!')
|
193 |
-
|
194 |
-
|
195 |
-
def parse_args():
|
196 |
-
parser = ArgumentParser(add_help=False)
|
197 |
-
parser.add_argument('--num_threads', type=int, default=1)
|
198 |
-
parser.add_argument('--root_path', type=str, default='')
|
199 |
-
args = parser.parse_args()
|
200 |
-
return args
|
201 |
-
|
202 |
-
|
203 |
-
def run(args):
|
204 |
-
root_path = args.root_path
|
205 |
-
out_crops_path = root_path + '_crops'
|
206 |
-
if not os.path.exists(out_crops_path):
|
207 |
-
os.makedirs(out_crops_path, exist_ok=True)
|
208 |
-
|
209 |
-
file_paths = []
|
210 |
-
for root, dirs, files in os.walk(root_path):
|
211 |
-
for file in files:
|
212 |
-
file_path = os.path.join(root, file)
|
213 |
-
fname = os.path.join(out_crops_path, os.path.relpath(file_path, root_path))
|
214 |
-
res_path = '{}.jpg'.format(os.path.splitext(fname)[0])
|
215 |
-
if os.path.splitext(file_path)[1] == '.txt' or os.path.exists(res_path):
|
216 |
-
continue
|
217 |
-
file_paths.append((file_path, res_path))
|
218 |
-
|
219 |
-
file_chunks = list(chunks(file_paths, int(math.ceil(len(file_paths) / args.num_threads))))
|
220 |
-
print(len(file_chunks))
|
221 |
-
pool = mp.Pool(args.num_threads)
|
222 |
-
print('Running on {} paths\nHere we goooo'.format(len(file_paths)))
|
223 |
-
tic = time.time()
|
224 |
-
pool.map(extract_on_paths, file_chunks)
|
225 |
-
toc = time.time()
|
226 |
-
print('Mischief managed in {}s'.format(toc - tic))
|
227 |
-
|
228 |
-
|
229 |
-
if __name__ == '__main__':
|
230 |
-
args = parse_args()
|
231 |
-
run(args)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/AIFILMS/StyleGANEX/models/stylegan2/lpips/networks_basic.py
DELETED
@@ -1,187 +0,0 @@
|
|
1 |
-
|
2 |
-
from __future__ import absolute_import
|
3 |
-
|
4 |
-
import sys
|
5 |
-
import torch
|
6 |
-
import torch.nn as nn
|
7 |
-
import torch.nn.init as init
|
8 |
-
from torch.autograd import Variable
|
9 |
-
import numpy as np
|
10 |
-
from pdb import set_trace as st
|
11 |
-
from skimage import color
|
12 |
-
from IPython import embed
|
13 |
-
from models.stylegan2.lpips import pretrained_networks as pn
|
14 |
-
|
15 |
-
import models.stylegan2.lpips as util
|
16 |
-
|
17 |
-
def spatial_average(in_tens, keepdim=True):
|
18 |
-
return in_tens.mean([2,3],keepdim=keepdim)
|
19 |
-
|
20 |
-
def upsample(in_tens, out_H=64): # assumes scale factor is same for H and W
|
21 |
-
in_H = in_tens.shape[2]
|
22 |
-
scale_factor = 1.*out_H/in_H
|
23 |
-
|
24 |
-
return nn.Upsample(scale_factor=scale_factor, mode='bilinear', align_corners=False)(in_tens)
|
25 |
-
|
26 |
-
# Learned perceptual metric
|
27 |
-
class PNetLin(nn.Module):
|
28 |
-
def __init__(self, pnet_type='vgg', pnet_rand=False, pnet_tune=False, use_dropout=True, spatial=False, version='0.1', lpips=True):
|
29 |
-
super(PNetLin, self).__init__()
|
30 |
-
|
31 |
-
self.pnet_type = pnet_type
|
32 |
-
self.pnet_tune = pnet_tune
|
33 |
-
self.pnet_rand = pnet_rand
|
34 |
-
self.spatial = spatial
|
35 |
-
self.lpips = lpips
|
36 |
-
self.version = version
|
37 |
-
self.scaling_layer = ScalingLayer()
|
38 |
-
|
39 |
-
if(self.pnet_type in ['vgg','vgg16']):
|
40 |
-
net_type = pn.vgg16
|
41 |
-
self.chns = [64,128,256,512,512]
|
42 |
-
elif(self.pnet_type=='alex'):
|
43 |
-
net_type = pn.alexnet
|
44 |
-
self.chns = [64,192,384,256,256]
|
45 |
-
elif(self.pnet_type=='squeeze'):
|
46 |
-
net_type = pn.squeezenet
|
47 |
-
self.chns = [64,128,256,384,384,512,512]
|
48 |
-
self.L = len(self.chns)
|
49 |
-
|
50 |
-
self.net = net_type(pretrained=not self.pnet_rand, requires_grad=self.pnet_tune)
|
51 |
-
|
52 |
-
if(lpips):
|
53 |
-
self.lin0 = NetLinLayer(self.chns[0], use_dropout=use_dropout)
|
54 |
-
self.lin1 = NetLinLayer(self.chns[1], use_dropout=use_dropout)
|
55 |
-
self.lin2 = NetLinLayer(self.chns[2], use_dropout=use_dropout)
|
56 |
-
self.lin3 = NetLinLayer(self.chns[3], use_dropout=use_dropout)
|
57 |
-
self.lin4 = NetLinLayer(self.chns[4], use_dropout=use_dropout)
|
58 |
-
self.lins = [self.lin0,self.lin1,self.lin2,self.lin3,self.lin4]
|
59 |
-
if(self.pnet_type=='squeeze'): # 7 layers for squeezenet
|
60 |
-
self.lin5 = NetLinLayer(self.chns[5], use_dropout=use_dropout)
|
61 |
-
self.lin6 = NetLinLayer(self.chns[6], use_dropout=use_dropout)
|
62 |
-
self.lins+=[self.lin5,self.lin6]
|
63 |
-
|
64 |
-
def forward(self, in0, in1, retPerLayer=False):
|
65 |
-
# v0.0 - original release had a bug, where input was not scaled
|
66 |
-
in0_input, in1_input = (self.scaling_layer(in0), self.scaling_layer(in1)) if self.version=='0.1' else (in0, in1)
|
67 |
-
outs0, outs1 = self.net.forward(in0_input), self.net.forward(in1_input)
|
68 |
-
feats0, feats1, diffs = {}, {}, {}
|
69 |
-
|
70 |
-
for kk in range(self.L):
|
71 |
-
feats0[kk], feats1[kk] = util.normalize_tensor(outs0[kk]), util.normalize_tensor(outs1[kk])
|
72 |
-
diffs[kk] = (feats0[kk]-feats1[kk])**2
|
73 |
-
|
74 |
-
if(self.lpips):
|
75 |
-
if(self.spatial):
|
76 |
-
res = [upsample(self.lins[kk].model(diffs[kk]), out_H=in0.shape[2]) for kk in range(self.L)]
|
77 |
-
else:
|
78 |
-
res = [spatial_average(self.lins[kk].model(diffs[kk]), keepdim=True) for kk in range(self.L)]
|
79 |
-
else:
|
80 |
-
if(self.spatial):
|
81 |
-
res = [upsample(diffs[kk].sum(dim=1,keepdim=True), out_H=in0.shape[2]) for kk in range(self.L)]
|
82 |
-
else:
|
83 |
-
res = [spatial_average(diffs[kk].sum(dim=1,keepdim=True), keepdim=True) for kk in range(self.L)]
|
84 |
-
|
85 |
-
val = res[0]
|
86 |
-
for l in range(1,self.L):
|
87 |
-
val += res[l]
|
88 |
-
|
89 |
-
if(retPerLayer):
|
90 |
-
return (val, res)
|
91 |
-
else:
|
92 |
-
return val
|
93 |
-
|
94 |
-
class ScalingLayer(nn.Module):
|
95 |
-
def __init__(self):
|
96 |
-
super(ScalingLayer, self).__init__()
|
97 |
-
self.register_buffer('shift', torch.Tensor([-.030,-.088,-.188])[None,:,None,None])
|
98 |
-
self.register_buffer('scale', torch.Tensor([.458,.448,.450])[None,:,None,None])
|
99 |
-
|
100 |
-
def forward(self, inp):
|
101 |
-
return (inp - self.shift) / self.scale
|
102 |
-
|
103 |
-
|
104 |
-
class NetLinLayer(nn.Module):
|
105 |
-
''' A single linear layer which does a 1x1 conv '''
|
106 |
-
def __init__(self, chn_in, chn_out=1, use_dropout=False):
|
107 |
-
super(NetLinLayer, self).__init__()
|
108 |
-
|
109 |
-
layers = [nn.Dropout(),] if(use_dropout) else []
|
110 |
-
layers += [nn.Conv2d(chn_in, chn_out, 1, stride=1, padding=0, bias=False),]
|
111 |
-
self.model = nn.Sequential(*layers)
|
112 |
-
|
113 |
-
|
114 |
-
class Dist2LogitLayer(nn.Module):
|
115 |
-
''' takes 2 distances, puts through fc layers, spits out value between [0,1] (if use_sigmoid is True) '''
|
116 |
-
def __init__(self, chn_mid=32, use_sigmoid=True):
|
117 |
-
super(Dist2LogitLayer, self).__init__()
|
118 |
-
|
119 |
-
layers = [nn.Conv2d(5, chn_mid, 1, stride=1, padding=0, bias=True),]
|
120 |
-
layers += [nn.LeakyReLU(0.2,True),]
|
121 |
-
layers += [nn.Conv2d(chn_mid, chn_mid, 1, stride=1, padding=0, bias=True),]
|
122 |
-
layers += [nn.LeakyReLU(0.2,True),]
|
123 |
-
layers += [nn.Conv2d(chn_mid, 1, 1, stride=1, padding=0, bias=True),]
|
124 |
-
if(use_sigmoid):
|
125 |
-
layers += [nn.Sigmoid(),]
|
126 |
-
self.model = nn.Sequential(*layers)
|
127 |
-
|
128 |
-
def forward(self,d0,d1,eps=0.1):
|
129 |
-
return self.model.forward(torch.cat((d0,d1,d0-d1,d0/(d1+eps),d1/(d0+eps)),dim=1))
|
130 |
-
|
131 |
-
class BCERankingLoss(nn.Module):
|
132 |
-
def __init__(self, chn_mid=32):
|
133 |
-
super(BCERankingLoss, self).__init__()
|
134 |
-
self.net = Dist2LogitLayer(chn_mid=chn_mid)
|
135 |
-
# self.parameters = list(self.net.parameters())
|
136 |
-
self.loss = torch.nn.BCELoss()
|
137 |
-
|
138 |
-
def forward(self, d0, d1, judge):
|
139 |
-
per = (judge+1.)/2.
|
140 |
-
self.logit = self.net.forward(d0,d1)
|
141 |
-
return self.loss(self.logit, per)
|
142 |
-
|
143 |
-
# L2, DSSIM metrics
|
144 |
-
class FakeNet(nn.Module):
|
145 |
-
def __init__(self, use_gpu=True, colorspace='Lab'):
|
146 |
-
super(FakeNet, self).__init__()
|
147 |
-
self.use_gpu = use_gpu
|
148 |
-
self.colorspace=colorspace
|
149 |
-
|
150 |
-
class L2(FakeNet):
|
151 |
-
|
152 |
-
def forward(self, in0, in1, retPerLayer=None):
|
153 |
-
assert(in0.size()[0]==1) # currently only supports batchSize 1
|
154 |
-
|
155 |
-
if(self.colorspace=='RGB'):
|
156 |
-
(N,C,X,Y) = in0.size()
|
157 |
-
value = torch.mean(torch.mean(torch.mean((in0-in1)**2,dim=1).view(N,1,X,Y),dim=2).view(N,1,1,Y),dim=3).view(N)
|
158 |
-
return value
|
159 |
-
elif(self.colorspace=='Lab'):
|
160 |
-
value = util.l2(util.tensor2np(util.tensor2tensorlab(in0.data,to_norm=False)),
|
161 |
-
util.tensor2np(util.tensor2tensorlab(in1.data,to_norm=False)), range=100.).astype('float')
|
162 |
-
ret_var = Variable( torch.Tensor((value,) ) )
|
163 |
-
if(self.use_gpu):
|
164 |
-
ret_var = ret_var.cuda()
|
165 |
-
return ret_var
|
166 |
-
|
167 |
-
class DSSIM(FakeNet):
|
168 |
-
|
169 |
-
def forward(self, in0, in1, retPerLayer=None):
|
170 |
-
assert(in0.size()[0]==1) # currently only supports batchSize 1
|
171 |
-
|
172 |
-
if(self.colorspace=='RGB'):
|
173 |
-
value = util.dssim(1.*util.tensor2im(in0.data), 1.*util.tensor2im(in1.data), range=255.).astype('float')
|
174 |
-
elif(self.colorspace=='Lab'):
|
175 |
-
value = util.dssim(util.tensor2np(util.tensor2tensorlab(in0.data,to_norm=False)),
|
176 |
-
util.tensor2np(util.tensor2tensorlab(in1.data,to_norm=False)), range=100.).astype('float')
|
177 |
-
ret_var = Variable( torch.Tensor((value,) ) )
|
178 |
-
if(self.use_gpu):
|
179 |
-
ret_var = ret_var.cuda()
|
180 |
-
return ret_var
|
181 |
-
|
182 |
-
def print_network(net):
|
183 |
-
num_params = 0
|
184 |
-
for param in net.parameters():
|
185 |
-
num_params += param.numel()
|
186 |
-
print('Network',net)
|
187 |
-
print('Total number of parameters: %d' % num_params)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/AIFILMS/audioldm-text-to-audio-generation/audioldm/clap/training/imagenet_zeroshot_data.py
DELETED
@@ -1,1088 +0,0 @@
|
|
1 |
-
# NOTE: This script is currently not supported for CLAP.
|
2 |
-
|
3 |
-
imagenet_classnames = [
|
4 |
-
"tench",
|
5 |
-
"goldfish",
|
6 |
-
"great white shark",
|
7 |
-
"tiger shark",
|
8 |
-
"hammerhead shark",
|
9 |
-
"electric ray",
|
10 |
-
"stingray",
|
11 |
-
"rooster",
|
12 |
-
"hen",
|
13 |
-
"ostrich",
|
14 |
-
"brambling",
|
15 |
-
"goldfinch",
|
16 |
-
"house finch",
|
17 |
-
"junco",
|
18 |
-
"indigo bunting",
|
19 |
-
"American robin",
|
20 |
-
"bulbul",
|
21 |
-
"jay",
|
22 |
-
"magpie",
|
23 |
-
"chickadee",
|
24 |
-
"American dipper",
|
25 |
-
"kite (bird of prey)",
|
26 |
-
"bald eagle",
|
27 |
-
"vulture",
|
28 |
-
"great grey owl",
|
29 |
-
"fire salamander",
|
30 |
-
"smooth newt",
|
31 |
-
"newt",
|
32 |
-
"spotted salamander",
|
33 |
-
"axolotl",
|
34 |
-
"American bullfrog",
|
35 |
-
"tree frog",
|
36 |
-
"tailed frog",
|
37 |
-
"loggerhead sea turtle",
|
38 |
-
"leatherback sea turtle",
|
39 |
-
"mud turtle",
|
40 |
-
"terrapin",
|
41 |
-
"box turtle",
|
42 |
-
"banded gecko",
|
43 |
-
"green iguana",
|
44 |
-
"Carolina anole",
|
45 |
-
"desert grassland whiptail lizard",
|
46 |
-
"agama",
|
47 |
-
"frilled-necked lizard",
|
48 |
-
"alligator lizard",
|
49 |
-
"Gila monster",
|
50 |
-
"European green lizard",
|
51 |
-
"chameleon",
|
52 |
-
"Komodo dragon",
|
53 |
-
"Nile crocodile",
|
54 |
-
"American alligator",
|
55 |
-
"triceratops",
|
56 |
-
"worm snake",
|
57 |
-
"ring-necked snake",
|
58 |
-
"eastern hog-nosed snake",
|
59 |
-
"smooth green snake",
|
60 |
-
"kingsnake",
|
61 |
-
"garter snake",
|
62 |
-
"water snake",
|
63 |
-
"vine snake",
|
64 |
-
"night snake",
|
65 |
-
"boa constrictor",
|
66 |
-
"African rock python",
|
67 |
-
"Indian cobra",
|
68 |
-
"green mamba",
|
69 |
-
"sea snake",
|
70 |
-
"Saharan horned viper",
|
71 |
-
"eastern diamondback rattlesnake",
|
72 |
-
"sidewinder rattlesnake",
|
73 |
-
"trilobite",
|
74 |
-
"harvestman",
|
75 |
-
"scorpion",
|
76 |
-
"yellow garden spider",
|
77 |
-
"barn spider",
|
78 |
-
"European garden spider",
|
79 |
-
"southern black widow",
|
80 |
-
"tarantula",
|
81 |
-
"wolf spider",
|
82 |
-
"tick",
|
83 |
-
"centipede",
|
84 |
-
"black grouse",
|
85 |
-
"ptarmigan",
|
86 |
-
"ruffed grouse",
|
87 |
-
"prairie grouse",
|
88 |
-
"peafowl",
|
89 |
-
"quail",
|
90 |
-
"partridge",
|
91 |
-
"african grey parrot",
|
92 |
-
"macaw",
|
93 |
-
"sulphur-crested cockatoo",
|
94 |
-
"lorikeet",
|
95 |
-
"coucal",
|
96 |
-
"bee eater",
|
97 |
-
"hornbill",
|
98 |
-
"hummingbird",
|
99 |
-
"jacamar",
|
100 |
-
"toucan",
|
101 |
-
"duck",
|
102 |
-
"red-breasted merganser",
|
103 |
-
"goose",
|
104 |
-
"black swan",
|
105 |
-
"tusker",
|
106 |
-
"echidna",
|
107 |
-
"platypus",
|
108 |
-
"wallaby",
|
109 |
-
"koala",
|
110 |
-
"wombat",
|
111 |
-
"jellyfish",
|
112 |
-
"sea anemone",
|
113 |
-
"brain coral",
|
114 |
-
"flatworm",
|
115 |
-
"nematode",
|
116 |
-
"conch",
|
117 |
-
"snail",
|
118 |
-
"slug",
|
119 |
-
"sea slug",
|
120 |
-
"chiton",
|
121 |
-
"chambered nautilus",
|
122 |
-
"Dungeness crab",
|
123 |
-
"rock crab",
|
124 |
-
"fiddler crab",
|
125 |
-
"red king crab",
|
126 |
-
"American lobster",
|
127 |
-
"spiny lobster",
|
128 |
-
"crayfish",
|
129 |
-
"hermit crab",
|
130 |
-
"isopod",
|
131 |
-
"white stork",
|
132 |
-
"black stork",
|
133 |
-
"spoonbill",
|
134 |
-
"flamingo",
|
135 |
-
"little blue heron",
|
136 |
-
"great egret",
|
137 |
-
"bittern bird",
|
138 |
-
"crane bird",
|
139 |
-
"limpkin",
|
140 |
-
"common gallinule",
|
141 |
-
"American coot",
|
142 |
-
"bustard",
|
143 |
-
"ruddy turnstone",
|
144 |
-
"dunlin",
|
145 |
-
"common redshank",
|
146 |
-
"dowitcher",
|
147 |
-
"oystercatcher",
|
148 |
-
"pelican",
|
149 |
-
"king penguin",
|
150 |
-
"albatross",
|
151 |
-
"grey whale",
|
152 |
-
"killer whale",
|
153 |
-
"dugong",
|
154 |
-
"sea lion",
|
155 |
-
"Chihuahua",
|
156 |
-
"Japanese Chin",
|
157 |
-
"Maltese",
|
158 |
-
"Pekingese",
|
159 |
-
"Shih Tzu",
|
160 |
-
"King Charles Spaniel",
|
161 |
-
"Papillon",
|
162 |
-
"toy terrier",
|
163 |
-
"Rhodesian Ridgeback",
|
164 |
-
"Afghan Hound",
|
165 |
-
"Basset Hound",
|
166 |
-
"Beagle",
|
167 |
-
"Bloodhound",
|
168 |
-
"Bluetick Coonhound",
|
169 |
-
"Black and Tan Coonhound",
|
170 |
-
"Treeing Walker Coonhound",
|
171 |
-
"English foxhound",
|
172 |
-
"Redbone Coonhound",
|
173 |
-
"borzoi",
|
174 |
-
"Irish Wolfhound",
|
175 |
-
"Italian Greyhound",
|
176 |
-
"Whippet",
|
177 |
-
"Ibizan Hound",
|
178 |
-
"Norwegian Elkhound",
|
179 |
-
"Otterhound",
|
180 |
-
"Saluki",
|
181 |
-
"Scottish Deerhound",
|
182 |
-
"Weimaraner",
|
183 |
-
"Staffordshire Bull Terrier",
|
184 |
-
"American Staffordshire Terrier",
|
185 |
-
"Bedlington Terrier",
|
186 |
-
"Border Terrier",
|
187 |
-
"Kerry Blue Terrier",
|
188 |
-
"Irish Terrier",
|
189 |
-
"Norfolk Terrier",
|
190 |
-
"Norwich Terrier",
|
191 |
-
"Yorkshire Terrier",
|
192 |
-
"Wire Fox Terrier",
|
193 |
-
"Lakeland Terrier",
|
194 |
-
"Sealyham Terrier",
|
195 |
-
"Airedale Terrier",
|
196 |
-
"Cairn Terrier",
|
197 |
-
"Australian Terrier",
|
198 |
-
"Dandie Dinmont Terrier",
|
199 |
-
"Boston Terrier",
|
200 |
-
"Miniature Schnauzer",
|
201 |
-
"Giant Schnauzer",
|
202 |
-
"Standard Schnauzer",
|
203 |
-
"Scottish Terrier",
|
204 |
-
"Tibetan Terrier",
|
205 |
-
"Australian Silky Terrier",
|
206 |
-
"Soft-coated Wheaten Terrier",
|
207 |
-
"West Highland White Terrier",
|
208 |
-
"Lhasa Apso",
|
209 |
-
"Flat-Coated Retriever",
|
210 |
-
"Curly-coated Retriever",
|
211 |
-
"Golden Retriever",
|
212 |
-
"Labrador Retriever",
|
213 |
-
"Chesapeake Bay Retriever",
|
214 |
-
"German Shorthaired Pointer",
|
215 |
-
"Vizsla",
|
216 |
-
"English Setter",
|
217 |
-
"Irish Setter",
|
218 |
-
"Gordon Setter",
|
219 |
-
"Brittany dog",
|
220 |
-
"Clumber Spaniel",
|
221 |
-
"English Springer Spaniel",
|
222 |
-
"Welsh Springer Spaniel",
|
223 |
-
"Cocker Spaniel",
|
224 |
-
"Sussex Spaniel",
|
225 |
-
"Irish Water Spaniel",
|
226 |
-
"Kuvasz",
|
227 |
-
"Schipperke",
|
228 |
-
"Groenendael dog",
|
229 |
-
"Malinois",
|
230 |
-
"Briard",
|
231 |
-
"Australian Kelpie",
|
232 |
-
"Komondor",
|
233 |
-
"Old English Sheepdog",
|
234 |
-
"Shetland Sheepdog",
|
235 |
-
"collie",
|
236 |
-
"Border Collie",
|
237 |
-
"Bouvier des Flandres dog",
|
238 |
-
"Rottweiler",
|
239 |
-
"German Shepherd Dog",
|
240 |
-
"Dobermann",
|
241 |
-
"Miniature Pinscher",
|
242 |
-
"Greater Swiss Mountain Dog",
|
243 |
-
"Bernese Mountain Dog",
|
244 |
-
"Appenzeller Sennenhund",
|
245 |
-
"Entlebucher Sennenhund",
|
246 |
-
"Boxer",
|
247 |
-
"Bullmastiff",
|
248 |
-
"Tibetan Mastiff",
|
249 |
-
"French Bulldog",
|
250 |
-
"Great Dane",
|
251 |
-
"St. Bernard",
|
252 |
-
"husky",
|
253 |
-
"Alaskan Malamute",
|
254 |
-
"Siberian Husky",
|
255 |
-
"Dalmatian",
|
256 |
-
"Affenpinscher",
|
257 |
-
"Basenji",
|
258 |
-
"pug",
|
259 |
-
"Leonberger",
|
260 |
-
"Newfoundland dog",
|
261 |
-
"Great Pyrenees dog",
|
262 |
-
"Samoyed",
|
263 |
-
"Pomeranian",
|
264 |
-
"Chow Chow",
|
265 |
-
"Keeshond",
|
266 |
-
"brussels griffon",
|
267 |
-
"Pembroke Welsh Corgi",
|
268 |
-
"Cardigan Welsh Corgi",
|
269 |
-
"Toy Poodle",
|
270 |
-
"Miniature Poodle",
|
271 |
-
"Standard Poodle",
|
272 |
-
"Mexican hairless dog (xoloitzcuintli)",
|
273 |
-
"grey wolf",
|
274 |
-
"Alaskan tundra wolf",
|
275 |
-
"red wolf or maned wolf",
|
276 |
-
"coyote",
|
277 |
-
"dingo",
|
278 |
-
"dhole",
|
279 |
-
"African wild dog",
|
280 |
-
"hyena",
|
281 |
-
"red fox",
|
282 |
-
"kit fox",
|
283 |
-
"Arctic fox",
|
284 |
-
"grey fox",
|
285 |
-
"tabby cat",
|
286 |
-
"tiger cat",
|
287 |
-
"Persian cat",
|
288 |
-
"Siamese cat",
|
289 |
-
"Egyptian Mau",
|
290 |
-
"cougar",
|
291 |
-
"lynx",
|
292 |
-
"leopard",
|
293 |
-
"snow leopard",
|
294 |
-
"jaguar",
|
295 |
-
"lion",
|
296 |
-
"tiger",
|
297 |
-
"cheetah",
|
298 |
-
"brown bear",
|
299 |
-
"American black bear",
|
300 |
-
"polar bear",
|
301 |
-
"sloth bear",
|
302 |
-
"mongoose",
|
303 |
-
"meerkat",
|
304 |
-
"tiger beetle",
|
305 |
-
"ladybug",
|
306 |
-
"ground beetle",
|
307 |
-
"longhorn beetle",
|
308 |
-
"leaf beetle",
|
309 |
-
"dung beetle",
|
310 |
-
"rhinoceros beetle",
|
311 |
-
"weevil",
|
312 |
-
"fly",
|
313 |
-
"bee",
|
314 |
-
"ant",
|
315 |
-
"grasshopper",
|
316 |
-
"cricket insect",
|
317 |
-
"stick insect",
|
318 |
-
"cockroach",
|
319 |
-
"praying mantis",
|
320 |
-
"cicada",
|
321 |
-
"leafhopper",
|
322 |
-
"lacewing",
|
323 |
-
"dragonfly",
|
324 |
-
"damselfly",
|
325 |
-
"red admiral butterfly",
|
326 |
-
"ringlet butterfly",
|
327 |
-
"monarch butterfly",
|
328 |
-
"small white butterfly",
|
329 |
-
"sulphur butterfly",
|
330 |
-
"gossamer-winged butterfly",
|
331 |
-
"starfish",
|
332 |
-
"sea urchin",
|
333 |
-
"sea cucumber",
|
334 |
-
"cottontail rabbit",
|
335 |
-
"hare",
|
336 |
-
"Angora rabbit",
|
337 |
-
"hamster",
|
338 |
-
"porcupine",
|
339 |
-
"fox squirrel",
|
340 |
-
"marmot",
|
341 |
-
"beaver",
|
342 |
-
"guinea pig",
|
343 |
-
"common sorrel horse",
|
344 |
-
"zebra",
|
345 |
-
"pig",
|
346 |
-
"wild boar",
|
347 |
-
"warthog",
|
348 |
-
"hippopotamus",
|
349 |
-
"ox",
|
350 |
-
"water buffalo",
|
351 |
-
"bison",
|
352 |
-
"ram (adult male sheep)",
|
353 |
-
"bighorn sheep",
|
354 |
-
"Alpine ibex",
|
355 |
-
"hartebeest",
|
356 |
-
"impala (antelope)",
|
357 |
-
"gazelle",
|
358 |
-
"arabian camel",
|
359 |
-
"llama",
|
360 |
-
"weasel",
|
361 |
-
"mink",
|
362 |
-
"European polecat",
|
363 |
-
"black-footed ferret",
|
364 |
-
"otter",
|
365 |
-
"skunk",
|
366 |
-
"badger",
|
367 |
-
"armadillo",
|
368 |
-
"three-toed sloth",
|
369 |
-
"orangutan",
|
370 |
-
"gorilla",
|
371 |
-
"chimpanzee",
|
372 |
-
"gibbon",
|
373 |
-
"siamang",
|
374 |
-
"guenon",
|
375 |
-
"patas monkey",
|
376 |
-
"baboon",
|
377 |
-
"macaque",
|
378 |
-
"langur",
|
379 |
-
"black-and-white colobus",
|
380 |
-
"proboscis monkey",
|
381 |
-
"marmoset",
|
382 |
-
"white-headed capuchin",
|
383 |
-
"howler monkey",
|
384 |
-
"titi monkey",
|
385 |
-
"Geoffroy's spider monkey",
|
386 |
-
"common squirrel monkey",
|
387 |
-
"ring-tailed lemur",
|
388 |
-
"indri",
|
389 |
-
"Asian elephant",
|
390 |
-
"African bush elephant",
|
391 |
-
"red panda",
|
392 |
-
"giant panda",
|
393 |
-
"snoek fish",
|
394 |
-
"eel",
|
395 |
-
"silver salmon",
|
396 |
-
"rock beauty fish",
|
397 |
-
"clownfish",
|
398 |
-
"sturgeon",
|
399 |
-
"gar fish",
|
400 |
-
"lionfish",
|
401 |
-
"pufferfish",
|
402 |
-
"abacus",
|
403 |
-
"abaya",
|
404 |
-
"academic gown",
|
405 |
-
"accordion",
|
406 |
-
"acoustic guitar",
|
407 |
-
"aircraft carrier",
|
408 |
-
"airliner",
|
409 |
-
"airship",
|
410 |
-
"altar",
|
411 |
-
"ambulance",
|
412 |
-
"amphibious vehicle",
|
413 |
-
"analog clock",
|
414 |
-
"apiary",
|
415 |
-
"apron",
|
416 |
-
"trash can",
|
417 |
-
"assault rifle",
|
418 |
-
"backpack",
|
419 |
-
"bakery",
|
420 |
-
"balance beam",
|
421 |
-
"balloon",
|
422 |
-
"ballpoint pen",
|
423 |
-
"Band-Aid",
|
424 |
-
"banjo",
|
425 |
-
"baluster / handrail",
|
426 |
-
"barbell",
|
427 |
-
"barber chair",
|
428 |
-
"barbershop",
|
429 |
-
"barn",
|
430 |
-
"barometer",
|
431 |
-
"barrel",
|
432 |
-
"wheelbarrow",
|
433 |
-
"baseball",
|
434 |
-
"basketball",
|
435 |
-
"bassinet",
|
436 |
-
"bassoon",
|
437 |
-
"swimming cap",
|
438 |
-
"bath towel",
|
439 |
-
"bathtub",
|
440 |
-
"station wagon",
|
441 |
-
"lighthouse",
|
442 |
-
"beaker",
|
443 |
-
"military hat (bearskin or shako)",
|
444 |
-
"beer bottle",
|
445 |
-
"beer glass",
|
446 |
-
"bell tower",
|
447 |
-
"baby bib",
|
448 |
-
"tandem bicycle",
|
449 |
-
"bikini",
|
450 |
-
"ring binder",
|
451 |
-
"binoculars",
|
452 |
-
"birdhouse",
|
453 |
-
"boathouse",
|
454 |
-
"bobsleigh",
|
455 |
-
"bolo tie",
|
456 |
-
"poke bonnet",
|
457 |
-
"bookcase",
|
458 |
-
"bookstore",
|
459 |
-
"bottle cap",
|
460 |
-
"hunting bow",
|
461 |
-
"bow tie",
|
462 |
-
"brass memorial plaque",
|
463 |
-
"bra",
|
464 |
-
"breakwater",
|
465 |
-
"breastplate",
|
466 |
-
"broom",
|
467 |
-
"bucket",
|
468 |
-
"buckle",
|
469 |
-
"bulletproof vest",
|
470 |
-
"high-speed train",
|
471 |
-
"butcher shop",
|
472 |
-
"taxicab",
|
473 |
-
"cauldron",
|
474 |
-
"candle",
|
475 |
-
"cannon",
|
476 |
-
"canoe",
|
477 |
-
"can opener",
|
478 |
-
"cardigan",
|
479 |
-
"car mirror",
|
480 |
-
"carousel",
|
481 |
-
"tool kit",
|
482 |
-
"cardboard box / carton",
|
483 |
-
"car wheel",
|
484 |
-
"automated teller machine",
|
485 |
-
"cassette",
|
486 |
-
"cassette player",
|
487 |
-
"castle",
|
488 |
-
"catamaran",
|
489 |
-
"CD player",
|
490 |
-
"cello",
|
491 |
-
"mobile phone",
|
492 |
-
"chain",
|
493 |
-
"chain-link fence",
|
494 |
-
"chain mail",
|
495 |
-
"chainsaw",
|
496 |
-
"storage chest",
|
497 |
-
"chiffonier",
|
498 |
-
"bell or wind chime",
|
499 |
-
"china cabinet",
|
500 |
-
"Christmas stocking",
|
501 |
-
"church",
|
502 |
-
"movie theater",
|
503 |
-
"cleaver",
|
504 |
-
"cliff dwelling",
|
505 |
-
"cloak",
|
506 |
-
"clogs",
|
507 |
-
"cocktail shaker",
|
508 |
-
"coffee mug",
|
509 |
-
"coffeemaker",
|
510 |
-
"spiral or coil",
|
511 |
-
"combination lock",
|
512 |
-
"computer keyboard",
|
513 |
-
"candy store",
|
514 |
-
"container ship",
|
515 |
-
"convertible",
|
516 |
-
"corkscrew",
|
517 |
-
"cornet",
|
518 |
-
"cowboy boot",
|
519 |
-
"cowboy hat",
|
520 |
-
"cradle",
|
521 |
-
"construction crane",
|
522 |
-
"crash helmet",
|
523 |
-
"crate",
|
524 |
-
"infant bed",
|
525 |
-
"Crock Pot",
|
526 |
-
"croquet ball",
|
527 |
-
"crutch",
|
528 |
-
"cuirass",
|
529 |
-
"dam",
|
530 |
-
"desk",
|
531 |
-
"desktop computer",
|
532 |
-
"rotary dial telephone",
|
533 |
-
"diaper",
|
534 |
-
"digital clock",
|
535 |
-
"digital watch",
|
536 |
-
"dining table",
|
537 |
-
"dishcloth",
|
538 |
-
"dishwasher",
|
539 |
-
"disc brake",
|
540 |
-
"dock",
|
541 |
-
"dog sled",
|
542 |
-
"dome",
|
543 |
-
"doormat",
|
544 |
-
"drilling rig",
|
545 |
-
"drum",
|
546 |
-
"drumstick",
|
547 |
-
"dumbbell",
|
548 |
-
"Dutch oven",
|
549 |
-
"electric fan",
|
550 |
-
"electric guitar",
|
551 |
-
"electric locomotive",
|
552 |
-
"entertainment center",
|
553 |
-
"envelope",
|
554 |
-
"espresso machine",
|
555 |
-
"face powder",
|
556 |
-
"feather boa",
|
557 |
-
"filing cabinet",
|
558 |
-
"fireboat",
|
559 |
-
"fire truck",
|
560 |
-
"fire screen",
|
561 |
-
"flagpole",
|
562 |
-
"flute",
|
563 |
-
"folding chair",
|
564 |
-
"football helmet",
|
565 |
-
"forklift",
|
566 |
-
"fountain",
|
567 |
-
"fountain pen",
|
568 |
-
"four-poster bed",
|
569 |
-
"freight car",
|
570 |
-
"French horn",
|
571 |
-
"frying pan",
|
572 |
-
"fur coat",
|
573 |
-
"garbage truck",
|
574 |
-
"gas mask or respirator",
|
575 |
-
"gas pump",
|
576 |
-
"goblet",
|
577 |
-
"go-kart",
|
578 |
-
"golf ball",
|
579 |
-
"golf cart",
|
580 |
-
"gondola",
|
581 |
-
"gong",
|
582 |
-
"gown",
|
583 |
-
"grand piano",
|
584 |
-
"greenhouse",
|
585 |
-
"radiator grille",
|
586 |
-
"grocery store",
|
587 |
-
"guillotine",
|
588 |
-
"hair clip",
|
589 |
-
"hair spray",
|
590 |
-
"half-track",
|
591 |
-
"hammer",
|
592 |
-
"hamper",
|
593 |
-
"hair dryer",
|
594 |
-
"hand-held computer",
|
595 |
-
"handkerchief",
|
596 |
-
"hard disk drive",
|
597 |
-
"harmonica",
|
598 |
-
"harp",
|
599 |
-
"combine harvester",
|
600 |
-
"hatchet",
|
601 |
-
"holster",
|
602 |
-
"home theater",
|
603 |
-
"honeycomb",
|
604 |
-
"hook",
|
605 |
-
"hoop skirt",
|
606 |
-
"gymnastic horizontal bar",
|
607 |
-
"horse-drawn vehicle",
|
608 |
-
"hourglass",
|
609 |
-
"iPod",
|
610 |
-
"clothes iron",
|
611 |
-
"carved pumpkin",
|
612 |
-
"jeans",
|
613 |
-
"jeep",
|
614 |
-
"T-shirt",
|
615 |
-
"jigsaw puzzle",
|
616 |
-
"rickshaw",
|
617 |
-
"joystick",
|
618 |
-
"kimono",
|
619 |
-
"knee pad",
|
620 |
-
"knot",
|
621 |
-
"lab coat",
|
622 |
-
"ladle",
|
623 |
-
"lampshade",
|
624 |
-
"laptop computer",
|
625 |
-
"lawn mower",
|
626 |
-
"lens cap",
|
627 |
-
"letter opener",
|
628 |
-
"library",
|
629 |
-
"lifeboat",
|
630 |
-
"lighter",
|
631 |
-
"limousine",
|
632 |
-
"ocean liner",
|
633 |
-
"lipstick",
|
634 |
-
"slip-on shoe",
|
635 |
-
"lotion",
|
636 |
-
"music speaker",
|
637 |
-
"loupe magnifying glass",
|
638 |
-
"sawmill",
|
639 |
-
"magnetic compass",
|
640 |
-
"messenger bag",
|
641 |
-
"mailbox",
|
642 |
-
"tights",
|
643 |
-
"one-piece bathing suit",
|
644 |
-
"manhole cover",
|
645 |
-
"maraca",
|
646 |
-
"marimba",
|
647 |
-
"mask",
|
648 |
-
"matchstick",
|
649 |
-
"maypole",
|
650 |
-
"maze",
|
651 |
-
"measuring cup",
|
652 |
-
"medicine cabinet",
|
653 |
-
"megalith",
|
654 |
-
"microphone",
|
655 |
-
"microwave oven",
|
656 |
-
"military uniform",
|
657 |
-
"milk can",
|
658 |
-
"minibus",
|
659 |
-
"miniskirt",
|
660 |
-
"minivan",
|
661 |
-
"missile",
|
662 |
-
"mitten",
|
663 |
-
"mixing bowl",
|
664 |
-
"mobile home",
|
665 |
-
"ford model t",
|
666 |
-
"modem",
|
667 |
-
"monastery",
|
668 |
-
"monitor",
|
669 |
-
"moped",
|
670 |
-
"mortar and pestle",
|
671 |
-
"graduation cap",
|
672 |
-
"mosque",
|
673 |
-
"mosquito net",
|
674 |
-
"vespa",
|
675 |
-
"mountain bike",
|
676 |
-
"tent",
|
677 |
-
"computer mouse",
|
678 |
-
"mousetrap",
|
679 |
-
"moving van",
|
680 |
-
"muzzle",
|
681 |
-
"metal nail",
|
682 |
-
"neck brace",
|
683 |
-
"necklace",
|
684 |
-
"baby pacifier",
|
685 |
-
"notebook computer",
|
686 |
-
"obelisk",
|
687 |
-
"oboe",
|
688 |
-
"ocarina",
|
689 |
-
"odometer",
|
690 |
-
"oil filter",
|
691 |
-
"pipe organ",
|
692 |
-
"oscilloscope",
|
693 |
-
"overskirt",
|
694 |
-
"bullock cart",
|
695 |
-
"oxygen mask",
|
696 |
-
"product packet / packaging",
|
697 |
-
"paddle",
|
698 |
-
"paddle wheel",
|
699 |
-
"padlock",
|
700 |
-
"paintbrush",
|
701 |
-
"pajamas",
|
702 |
-
"palace",
|
703 |
-
"pan flute",
|
704 |
-
"paper towel",
|
705 |
-
"parachute",
|
706 |
-
"parallel bars",
|
707 |
-
"park bench",
|
708 |
-
"parking meter",
|
709 |
-
"railroad car",
|
710 |
-
"patio",
|
711 |
-
"payphone",
|
712 |
-
"pedestal",
|
713 |
-
"pencil case",
|
714 |
-
"pencil sharpener",
|
715 |
-
"perfume",
|
716 |
-
"Petri dish",
|
717 |
-
"photocopier",
|
718 |
-
"plectrum",
|
719 |
-
"Pickelhaube",
|
720 |
-
"picket fence",
|
721 |
-
"pickup truck",
|
722 |
-
"pier",
|
723 |
-
"piggy bank",
|
724 |
-
"pill bottle",
|
725 |
-
"pillow",
|
726 |
-
"ping-pong ball",
|
727 |
-
"pinwheel",
|
728 |
-
"pirate ship",
|
729 |
-
"drink pitcher",
|
730 |
-
"block plane",
|
731 |
-
"planetarium",
|
732 |
-
"plastic bag",
|
733 |
-
"plate rack",
|
734 |
-
"farm plow",
|
735 |
-
"plunger",
|
736 |
-
"Polaroid camera",
|
737 |
-
"pole",
|
738 |
-
"police van",
|
739 |
-
"poncho",
|
740 |
-
"pool table",
|
741 |
-
"soda bottle",
|
742 |
-
"plant pot",
|
743 |
-
"potter's wheel",
|
744 |
-
"power drill",
|
745 |
-
"prayer rug",
|
746 |
-
"printer",
|
747 |
-
"prison",
|
748 |
-
"missile",
|
749 |
-
"projector",
|
750 |
-
"hockey puck",
|
751 |
-
"punching bag",
|
752 |
-
"purse",
|
753 |
-
"quill",
|
754 |
-
"quilt",
|
755 |
-
"race car",
|
756 |
-
"racket",
|
757 |
-
"radiator",
|
758 |
-
"radio",
|
759 |
-
"radio telescope",
|
760 |
-
"rain barrel",
|
761 |
-
"recreational vehicle",
|
762 |
-
"fishing casting reel",
|
763 |
-
"reflex camera",
|
764 |
-
"refrigerator",
|
765 |
-
"remote control",
|
766 |
-
"restaurant",
|
767 |
-
"revolver",
|
768 |
-
"rifle",
|
769 |
-
"rocking chair",
|
770 |
-
"rotisserie",
|
771 |
-
"eraser",
|
772 |
-
"rugby ball",
|
773 |
-
"ruler measuring stick",
|
774 |
-
"sneaker",
|
775 |
-
"safe",
|
776 |
-
"safety pin",
|
777 |
-
"salt shaker",
|
778 |
-
"sandal",
|
779 |
-
"sarong",
|
780 |
-
"saxophone",
|
781 |
-
"scabbard",
|
782 |
-
"weighing scale",
|
783 |
-
"school bus",
|
784 |
-
"schooner",
|
785 |
-
"scoreboard",
|
786 |
-
"CRT monitor",
|
787 |
-
"screw",
|
788 |
-
"screwdriver",
|
789 |
-
"seat belt",
|
790 |
-
"sewing machine",
|
791 |
-
"shield",
|
792 |
-
"shoe store",
|
793 |
-
"shoji screen / room divider",
|
794 |
-
"shopping basket",
|
795 |
-
"shopping cart",
|
796 |
-
"shovel",
|
797 |
-
"shower cap",
|
798 |
-
"shower curtain",
|
799 |
-
"ski",
|
800 |
-
"balaclava ski mask",
|
801 |
-
"sleeping bag",
|
802 |
-
"slide rule",
|
803 |
-
"sliding door",
|
804 |
-
"slot machine",
|
805 |
-
"snorkel",
|
806 |
-
"snowmobile",
|
807 |
-
"snowplow",
|
808 |
-
"soap dispenser",
|
809 |
-
"soccer ball",
|
810 |
-
"sock",
|
811 |
-
"solar thermal collector",
|
812 |
-
"sombrero",
|
813 |
-
"soup bowl",
|
814 |
-
"keyboard space bar",
|
815 |
-
"space heater",
|
816 |
-
"space shuttle",
|
817 |
-
"spatula",
|
818 |
-
"motorboat",
|
819 |
-
"spider web",
|
820 |
-
"spindle",
|
821 |
-
"sports car",
|
822 |
-
"spotlight",
|
823 |
-
"stage",
|
824 |
-
"steam locomotive",
|
825 |
-
"through arch bridge",
|
826 |
-
"steel drum",
|
827 |
-
"stethoscope",
|
828 |
-
"scarf",
|
829 |
-
"stone wall",
|
830 |
-
"stopwatch",
|
831 |
-
"stove",
|
832 |
-
"strainer",
|
833 |
-
"tram",
|
834 |
-
"stretcher",
|
835 |
-
"couch",
|
836 |
-
"stupa",
|
837 |
-
"submarine",
|
838 |
-
"suit",
|
839 |
-
"sundial",
|
840 |
-
"sunglasses",
|
841 |
-
"sunglasses",
|
842 |
-
"sunscreen",
|
843 |
-
"suspension bridge",
|
844 |
-
"mop",
|
845 |
-
"sweatshirt",
|
846 |
-
"swim trunks / shorts",
|
847 |
-
"swing",
|
848 |
-
"electrical switch",
|
849 |
-
"syringe",
|
850 |
-
"table lamp",
|
851 |
-
"tank",
|
852 |
-
"tape player",
|
853 |
-
"teapot",
|
854 |
-
"teddy bear",
|
855 |
-
"television",
|
856 |
-
"tennis ball",
|
857 |
-
"thatched roof",
|
858 |
-
"front curtain",
|
859 |
-
"thimble",
|
860 |
-
"threshing machine",
|
861 |
-
"throne",
|
862 |
-
"tile roof",
|
863 |
-
"toaster",
|
864 |
-
"tobacco shop",
|
865 |
-
"toilet seat",
|
866 |
-
"torch",
|
867 |
-
"totem pole",
|
868 |
-
"tow truck",
|
869 |
-
"toy store",
|
870 |
-
"tractor",
|
871 |
-
"semi-trailer truck",
|
872 |
-
"tray",
|
873 |
-
"trench coat",
|
874 |
-
"tricycle",
|
875 |
-
"trimaran",
|
876 |
-
"tripod",
|
877 |
-
"triumphal arch",
|
878 |
-
"trolleybus",
|
879 |
-
"trombone",
|
880 |
-
"hot tub",
|
881 |
-
"turnstile",
|
882 |
-
"typewriter keyboard",
|
883 |
-
"umbrella",
|
884 |
-
"unicycle",
|
885 |
-
"upright piano",
|
886 |
-
"vacuum cleaner",
|
887 |
-
"vase",
|
888 |
-
"vaulted or arched ceiling",
|
889 |
-
"velvet fabric",
|
890 |
-
"vending machine",
|
891 |
-
"vestment",
|
892 |
-
"viaduct",
|
893 |
-
"violin",
|
894 |
-
"volleyball",
|
895 |
-
"waffle iron",
|
896 |
-
"wall clock",
|
897 |
-
"wallet",
|
898 |
-
"wardrobe",
|
899 |
-
"military aircraft",
|
900 |
-
"sink",
|
901 |
-
"washing machine",
|
902 |
-
"water bottle",
|
903 |
-
"water jug",
|
904 |
-
"water tower",
|
905 |
-
"whiskey jug",
|
906 |
-
"whistle",
|
907 |
-
"hair wig",
|
908 |
-
"window screen",
|
909 |
-
"window shade",
|
910 |
-
"Windsor tie",
|
911 |
-
"wine bottle",
|
912 |
-
"airplane wing",
|
913 |
-
"wok",
|
914 |
-
"wooden spoon",
|
915 |
-
"wool",
|
916 |
-
"split-rail fence",
|
917 |
-
"shipwreck",
|
918 |
-
"sailboat",
|
919 |
-
"yurt",
|
920 |
-
"website",
|
921 |
-
"comic book",
|
922 |
-
"crossword",
|
923 |
-
"traffic or street sign",
|
924 |
-
"traffic light",
|
925 |
-
"dust jacket",
|
926 |
-
"menu",
|
927 |
-
"plate",
|
928 |
-
"guacamole",
|
929 |
-
"consomme",
|
930 |
-
"hot pot",
|
931 |
-
"trifle",
|
932 |
-
"ice cream",
|
933 |
-
"popsicle",
|
934 |
-
"baguette",
|
935 |
-
"bagel",
|
936 |
-
"pretzel",
|
937 |
-
"cheeseburger",
|
938 |
-
"hot dog",
|
939 |
-
"mashed potatoes",
|
940 |
-
"cabbage",
|
941 |
-
"broccoli",
|
942 |
-
"cauliflower",
|
943 |
-
"zucchini",
|
944 |
-
"spaghetti squash",
|
945 |
-
"acorn squash",
|
946 |
-
"butternut squash",
|
947 |
-
"cucumber",
|
948 |
-
"artichoke",
|
949 |
-
"bell pepper",
|
950 |
-
"cardoon",
|
951 |
-
"mushroom",
|
952 |
-
"Granny Smith apple",
|
953 |
-
"strawberry",
|
954 |
-
"orange",
|
955 |
-
"lemon",
|
956 |
-
"fig",
|
957 |
-
"pineapple",
|
958 |
-
"banana",
|
959 |
-
"jackfruit",
|
960 |
-
"cherimoya (custard apple)",
|
961 |
-
"pomegranate",
|
962 |
-
"hay",
|
963 |
-
"carbonara",
|
964 |
-
"chocolate syrup",
|
965 |
-
"dough",
|
966 |
-
"meatloaf",
|
967 |
-
"pizza",
|
968 |
-
"pot pie",
|
969 |
-
"burrito",
|
970 |
-
"red wine",
|
971 |
-
"espresso",
|
972 |
-
"tea cup",
|
973 |
-
"eggnog",
|
974 |
-
"mountain",
|
975 |
-
"bubble",
|
976 |
-
"cliff",
|
977 |
-
"coral reef",
|
978 |
-
"geyser",
|
979 |
-
"lakeshore",
|
980 |
-
"promontory",
|
981 |
-
"sandbar",
|
982 |
-
"beach",
|
983 |
-
"valley",
|
984 |
-
"volcano",
|
985 |
-
"baseball player",
|
986 |
-
"bridegroom",
|
987 |
-
"scuba diver",
|
988 |
-
"rapeseed",
|
989 |
-
"daisy",
|
990 |
-
"yellow lady's slipper",
|
991 |
-
"corn",
|
992 |
-
"acorn",
|
993 |
-
"rose hip",
|
994 |
-
"horse chestnut seed",
|
995 |
-
"coral fungus",
|
996 |
-
"agaric",
|
997 |
-
"gyromitra",
|
998 |
-
"stinkhorn mushroom",
|
999 |
-
"earth star fungus",
|
1000 |
-
"hen of the woods mushroom",
|
1001 |
-
"bolete",
|
1002 |
-
"corn cob",
|
1003 |
-
"toilet paper",
|
1004 |
-
]
|
1005 |
-
|
1006 |
-
|
1007 |
-
openai_imagenet_template = [
|
1008 |
-
lambda c: f"a bad photo of a {c}.",
|
1009 |
-
lambda c: f"a photo of many {c}.",
|
1010 |
-
lambda c: f"a sculpture of a {c}.",
|
1011 |
-
lambda c: f"a photo of the hard to see {c}.",
|
1012 |
-
lambda c: f"a low resolution photo of the {c}.",
|
1013 |
-
lambda c: f"a rendering of a {c}.",
|
1014 |
-
lambda c: f"graffiti of a {c}.",
|
1015 |
-
lambda c: f"a bad photo of the {c}.",
|
1016 |
-
lambda c: f"a cropped photo of the {c}.",
|
1017 |
-
lambda c: f"a tattoo of a {c}.",
|
1018 |
-
lambda c: f"the embroidered {c}.",
|
1019 |
-
lambda c: f"a photo of a hard to see {c}.",
|
1020 |
-
lambda c: f"a bright photo of a {c}.",
|
1021 |
-
lambda c: f"a photo of a clean {c}.",
|
1022 |
-
lambda c: f"a photo of a dirty {c}.",
|
1023 |
-
lambda c: f"a dark photo of the {c}.",
|
1024 |
-
lambda c: f"a drawing of a {c}.",
|
1025 |
-
lambda c: f"a photo of my {c}.",
|
1026 |
-
lambda c: f"the plastic {c}.",
|
1027 |
-
lambda c: f"a photo of the cool {c}.",
|
1028 |
-
lambda c: f"a close-up photo of a {c}.",
|
1029 |
-
lambda c: f"a black and white photo of the {c}.",
|
1030 |
-
lambda c: f"a painting of the {c}.",
|
1031 |
-
lambda c: f"a painting of a {c}.",
|
1032 |
-
lambda c: f"a pixelated photo of the {c}.",
|
1033 |
-
lambda c: f"a sculpture of the {c}.",
|
1034 |
-
lambda c: f"a bright photo of the {c}.",
|
1035 |
-
lambda c: f"a cropped photo of a {c}.",
|
1036 |
-
lambda c: f"a plastic {c}.",
|
1037 |
-
lambda c: f"a photo of the dirty {c}.",
|
1038 |
-
lambda c: f"a jpeg corrupted photo of a {c}.",
|
1039 |
-
lambda c: f"a blurry photo of the {c}.",
|
1040 |
-
lambda c: f"a photo of the {c}.",
|
1041 |
-
lambda c: f"a good photo of the {c}.",
|
1042 |
-
lambda c: f"a rendering of the {c}.",
|
1043 |
-
lambda c: f"a {c} in a video game.",
|
1044 |
-
lambda c: f"a photo of one {c}.",
|
1045 |
-
lambda c: f"a doodle of a {c}.",
|
1046 |
-
lambda c: f"a close-up photo of the {c}.",
|
1047 |
-
lambda c: f"a photo of a {c}.",
|
1048 |
-
lambda c: f"the origami {c}.",
|
1049 |
-
lambda c: f"the {c} in a video game.",
|
1050 |
-
lambda c: f"a sketch of a {c}.",
|
1051 |
-
lambda c: f"a doodle of the {c}.",
|
1052 |
-
lambda c: f"a origami {c}.",
|
1053 |
-
lambda c: f"a low resolution photo of a {c}.",
|
1054 |
-
lambda c: f"the toy {c}.",
|
1055 |
-
lambda c: f"a rendition of the {c}.",
|
1056 |
-
lambda c: f"a photo of the clean {c}.",
|
1057 |
-
lambda c: f"a photo of a large {c}.",
|
1058 |
-
lambda c: f"a rendition of a {c}.",
|
1059 |
-
lambda c: f"a photo of a nice {c}.",
|
1060 |
-
lambda c: f"a photo of a weird {c}.",
|
1061 |
-
lambda c: f"a blurry photo of a {c}.",
|
1062 |
-
lambda c: f"a cartoon {c}.",
|
1063 |
-
lambda c: f"art of a {c}.",
|
1064 |
-
lambda c: f"a sketch of the {c}.",
|
1065 |
-
lambda c: f"a embroidered {c}.",
|
1066 |
-
lambda c: f"a pixelated photo of a {c}.",
|
1067 |
-
lambda c: f"itap of the {c}.",
|
1068 |
-
lambda c: f"a jpeg corrupted photo of the {c}.",
|
1069 |
-
lambda c: f"a good photo of a {c}.",
|
1070 |
-
lambda c: f"a plushie {c}.",
|
1071 |
-
lambda c: f"a photo of the nice {c}.",
|
1072 |
-
lambda c: f"a photo of the small {c}.",
|
1073 |
-
lambda c: f"a photo of the weird {c}.",
|
1074 |
-
lambda c: f"the cartoon {c}.",
|
1075 |
-
lambda c: f"art of the {c}.",
|
1076 |
-
lambda c: f"a drawing of the {c}.",
|
1077 |
-
lambda c: f"a photo of the large {c}.",
|
1078 |
-
lambda c: f"a black and white photo of a {c}.",
|
1079 |
-
lambda c: f"the plushie {c}.",
|
1080 |
-
lambda c: f"a dark photo of a {c}.",
|
1081 |
-
lambda c: f"itap of a {c}.",
|
1082 |
-
lambda c: f"graffiti of the {c}.",
|
1083 |
-
lambda c: f"a toy {c}.",
|
1084 |
-
lambda c: f"itap of my {c}.",
|
1085 |
-
lambda c: f"a photo of a cool {c}.",
|
1086 |
-
lambda c: f"a photo of a small {c}.",
|
1087 |
-
lambda c: f"a tattoo of the {c}.",
|
1088 |
-
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/AIWaves/SOP_Generation-single/__init__.py
DELETED
@@ -1,4 +0,0 @@
|
|
1 |
-
from .evolve import *
|
2 |
-
from .SOP import *
|
3 |
-
from .State import *
|
4 |
-
from .utils import *
|
|
|
|
|
|
|
|
|
|
spaces/ATang0729/Forecast4Muses/Model/Model6/Model6_2_ProfileRecogition/mmpretrain/configs/resnet/resnet152_8xb16_cifar10.py
DELETED
@@ -1,5 +0,0 @@
|
|
1 |
-
_base_ = [
|
2 |
-
'../_base_/models/resnet152_cifar.py',
|
3 |
-
'../_base_/datasets/cifar10_bs16.py',
|
4 |
-
'../_base_/schedules/cifar10_bs128.py', '../_base_/default_runtime.py'
|
5 |
-
]
|
|
|
|
|
|
|
|
|
|
|
|
spaces/AbandonedMuse/UnlimitedMusicGen/audiocraft/modules/activations.py
DELETED
@@ -1,96 +0,0 @@
|
|
1 |
-
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
2 |
-
# All rights reserved.
|
3 |
-
#
|
4 |
-
# This source code is licensed under the license found in the
|
5 |
-
# LICENSE file in the root directory of this source tree.
|
6 |
-
|
7 |
-
import torch
|
8 |
-
import torch.nn as nn
|
9 |
-
from torch import Tensor
|
10 |
-
from typing import Union, Callable
|
11 |
-
|
12 |
-
|
13 |
-
class CustomGLU(nn.Module):
|
14 |
-
"""Custom Gated Linear Unit activation.
|
15 |
-
Applies a modified gated linear unit :math:`a * f(b)` where :math:`a` is the first half
|
16 |
-
of the input matrices, :math:`b` is the second half, and :math:`f` is a provided activation
|
17 |
-
function (i.e. sigmoid, swish, etc.).
|
18 |
-
|
19 |
-
Args:
|
20 |
-
activation (nn.Module): The custom activation to apply in the Gated Linear Unit
|
21 |
-
dim (int): the dimension on which to split the input. Default: -1
|
22 |
-
|
23 |
-
Shape:
|
24 |
-
- Input: :math:`(\ast_1, N, \ast_2)` where `*` means, any number of additional
|
25 |
-
dimensions
|
26 |
-
- Output: :math:`(\ast_1, M, \ast_2)` where :math:`M=N/2`
|
27 |
-
|
28 |
-
Examples::
|
29 |
-
>>> m = CustomGLU(nn.Sigmoid())
|
30 |
-
>>> input = torch.randn(4, 2)
|
31 |
-
>>> output = m(input)
|
32 |
-
"""
|
33 |
-
def __init__(self, activation: nn.Module, dim: int = -1):
|
34 |
-
super(CustomGLU, self).__init__()
|
35 |
-
self.dim = dim
|
36 |
-
self.activation = activation
|
37 |
-
|
38 |
-
def forward(self, x: Tensor):
|
39 |
-
assert x.shape[self.dim] % 2 == 0 # M = N / 2
|
40 |
-
a, b = torch.chunk(x, 2, dim=self.dim)
|
41 |
-
return a * self.activation(b)
|
42 |
-
|
43 |
-
|
44 |
-
class SwiGLU(CustomGLU):
|
45 |
-
"""SiLU Gated Linear Unit activation.
|
46 |
-
Applies SiLU Gated Linear Unit :math:`a * SiLU(b)` where :math:`a` is
|
47 |
-
the first half of the input matrices, :math:`b` is the second half.
|
48 |
-
|
49 |
-
Args:
|
50 |
-
dim (int): the dimension on which to split the input. Default: -1
|
51 |
-
"""
|
52 |
-
def __init__(self, dim: int = -1):
|
53 |
-
super(SwiGLU, self).__init__(nn.SiLU(), dim)
|
54 |
-
|
55 |
-
|
56 |
-
class GeGLU(CustomGLU):
|
57 |
-
"""GeLU Gated Linear Unit activation.
|
58 |
-
Applies GeLU Gated Linear Unit :math:`a * GELU(b)` where :math:`a` is
|
59 |
-
the first half of the input matrices, :math:`b` is the second half.
|
60 |
-
|
61 |
-
Args:
|
62 |
-
dim (int): the dimension on which to split the input. Default: -1
|
63 |
-
"""
|
64 |
-
def __init__(self, dim: int = -1):
|
65 |
-
super(GeGLU, self).__init__(nn.GELU(), dim)
|
66 |
-
|
67 |
-
|
68 |
-
class ReGLU(CustomGLU):
|
69 |
-
"""ReLU Gated Linear Unit activation.
|
70 |
-
Applies ReLU Gated Linear Unit :math:`a * ReLU(b)` where :math:`a` is
|
71 |
-
the first half of the input matrices, :math:`b` is the second half.
|
72 |
-
|
73 |
-
Args:
|
74 |
-
dim (int): the dimension on which to split the input. Default: -1
|
75 |
-
"""
|
76 |
-
def __init__(self, dim: int = -1):
|
77 |
-
super(ReGLU, self).__init__(nn.ReLU(), dim)
|
78 |
-
|
79 |
-
|
80 |
-
def get_activation_fn(
|
81 |
-
activation: Union[str, Callable[[Tensor], Tensor]]
|
82 |
-
) -> Union[str, Callable[[Tensor], Tensor]]:
|
83 |
-
"""Helper function to map an activation string to the activation class.
|
84 |
-
If the supplied activation is not a string that is recognized, the activation is passed back.
|
85 |
-
|
86 |
-
Args:
|
87 |
-
activation (Union[str, Callable[[Tensor], Tensor]]): Activation to check
|
88 |
-
"""
|
89 |
-
if isinstance(activation, str):
|
90 |
-
if activation == "reglu":
|
91 |
-
return ReGLU()
|
92 |
-
elif activation == "geglu":
|
93 |
-
return GeGLU()
|
94 |
-
elif activation == "swiglu":
|
95 |
-
return SwiGLU()
|
96 |
-
return activation
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Abbasghanbari/Abo/README.md
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
---
|
2 |
-
title: Abo
|
3 |
-
emoji: 💻
|
4 |
-
colorFrom: pink
|
5 |
-
colorTo: yellow
|
6 |
-
sdk: gradio
|
7 |
-
sdk_version: 3.19.1
|
8 |
-
app_file: app.py
|
9 |
-
pinned: false
|
10 |
-
---
|
11 |
-
|
12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/AchyuthGamer/OpenGPT/g4f/Provider/Providers/Acytoo.py
DELETED
@@ -1,51 +0,0 @@
|
|
1 |
-
from __future__ import annotations
|
2 |
-
|
3 |
-
from aiohttp import ClientSession
|
4 |
-
|
5 |
-
from ..typing import AsyncGenerator
|
6 |
-
from .base_provider import AsyncGeneratorProvider
|
7 |
-
|
8 |
-
|
9 |
-
class Acytoo(AsyncGeneratorProvider):
|
10 |
-
url = 'https://chat.acytoo.com'
|
11 |
-
working = True
|
12 |
-
supports_gpt_35_turbo = True
|
13 |
-
|
14 |
-
@classmethod
|
15 |
-
async def create_async_generator(
|
16 |
-
cls,
|
17 |
-
model: str,
|
18 |
-
messages: list[dict[str, str]],
|
19 |
-
proxy: str = None,
|
20 |
-
**kwargs
|
21 |
-
) -> AsyncGenerator:
|
22 |
-
|
23 |
-
async with ClientSession(
|
24 |
-
headers=_create_header()
|
25 |
-
) as session:
|
26 |
-
async with session.post(
|
27 |
-
cls.url + '/api/completions',
|
28 |
-
proxy=proxy,
|
29 |
-
json=_create_payload(messages, **kwargs)
|
30 |
-
) as response:
|
31 |
-
response.raise_for_status()
|
32 |
-
async for stream in response.content.iter_any():
|
33 |
-
if stream:
|
34 |
-
yield stream.decode()
|
35 |
-
|
36 |
-
|
37 |
-
def _create_header():
|
38 |
-
return {
|
39 |
-
'accept': '*/*',
|
40 |
-
'content-type': 'application/json',
|
41 |
-
}
|
42 |
-
|
43 |
-
|
44 |
-
def _create_payload(messages: list[dict[str, str]], temperature: float = 0.5, **kwargs):
|
45 |
-
return {
|
46 |
-
'key' : '',
|
47 |
-
'model' : 'gpt-3.5-turbo',
|
48 |
-
'messages' : messages,
|
49 |
-
'temperature' : temperature,
|
50 |
-
'password' : ''
|
51 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Adapter/CoAdapter/ldm/modules/image_degradation/__init__.py
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
from ldm.modules.image_degradation.bsrgan import degradation_bsrgan_variant as degradation_fn_bsr
|
2 |
-
from ldm.modules.image_degradation.bsrgan_light import degradation_bsrgan_variant as degradation_fn_bsr_light
|
|
|
|
|
|
spaces/AgentVerse/agentVerse/ui/src/phaser3-rex-plugins/templates/bejeweled/actions/SwapChess.js
DELETED
@@ -1,30 +0,0 @@
|
|
1 |
-
var SwapChess = function (chess1, chess2, board, bejeweled) {
|
2 |
-
var tileXYZ1 = board.chessToTileXYZ(chess1);
|
3 |
-
var tileXYZ2 = board.chessToTileXYZ(chess2);
|
4 |
-
var tileX1 = tileXYZ1.x,
|
5 |
-
tileY1 = tileXYZ1.y,
|
6 |
-
tileX2 = tileXYZ2.x,
|
7 |
-
tileY2 = tileXYZ2.y,
|
8 |
-
tileZ = tileXYZ1.z;
|
9 |
-
|
10 |
-
// TileZ of chess1 and chess2 are the same, change tileZ of chess2 to a different value
|
11 |
-
board.setChessTileZ(chess2, `#${tileZ}`);
|
12 |
-
|
13 |
-
// Move chess1 to tileXYZ2, chess2 to tileXYZ1
|
14 |
-
var moveTo1 = bejeweled.getChessMoveTo(chess1);
|
15 |
-
var moveTo2 = bejeweled.getChessMoveTo(chess2);
|
16 |
-
moveTo1.moveTo(tileX2, tileY2);
|
17 |
-
moveTo2.moveTo(tileX1, tileY1);
|
18 |
-
|
19 |
-
// Change tileZ of chess2 back
|
20 |
-
board.setChessTileZ(chess2, tileZ);
|
21 |
-
|
22 |
-
if (moveTo1.isRunning) {
|
23 |
-
bejeweled.waitEvent(moveTo1, 'complete');
|
24 |
-
}
|
25 |
-
if (moveTo2.isRunning) {
|
26 |
-
bejeweled.waitEvent(moveTo2, 'complete');
|
27 |
-
}
|
28 |
-
};
|
29 |
-
|
30 |
-
export default SwapChess;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/AgentVerse/agentVerse/ui/src/phaser3-rex-plugins/templates/ui/gridtable/input/PressCell.js
DELETED
@@ -1,22 +0,0 @@
|
|
1 |
-
import Press from '../../press/Press.js';
|
2 |
-
import EmitCellEvent from './EmitCellEvent.js';
|
3 |
-
|
4 |
-
const GetValue = Phaser.Utils.Objects.GetValue;
|
5 |
-
|
6 |
-
var PressCell = function (table, tableConfig) {
|
7 |
-
var pressConfig = GetValue(tableConfig, 'press', undefined);
|
8 |
-
if (pressConfig === false) {
|
9 |
-
return;
|
10 |
-
}
|
11 |
-
|
12 |
-
table._press = new Press(table, pressConfig);
|
13 |
-
table._press
|
14 |
-
.on('pressstart', function (press, gameObject, lastPointer) {
|
15 |
-
EmitCellEvent(this.eventEmitter, 'cell.pressstart', table, press.worldX, press.worldY, lastPointer);
|
16 |
-
}, this)
|
17 |
-
.on('pressend', function (press, gameObject, lastPointer) {
|
18 |
-
EmitCellEvent(this.eventEmitter, 'cell.pressend', table, press.worldX, press.worldY, lastPointer);
|
19 |
-
}, this)
|
20 |
-
};
|
21 |
-
|
22 |
-
export default PressCell;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/AgentVerse/agentVerse/ui/src/phaser3-rex-plugins/templates/ui/scrollablepanel/scrollableblock/Methods.js
DELETED
@@ -1,21 +0,0 @@
|
|
1 |
-
import GetChildrenWidth from './GetChildrenWidth.js';
|
2 |
-
import GetChildrenHeight from './GetChildrenHeight.js';
|
3 |
-
import GetChildrenSizers from './GetChildrenSizers.js';
|
4 |
-
import ResetChildPosition from './ResetChildPosition.js';
|
5 |
-
import LayoutChildren from './LayoutChildren.js';
|
6 |
-
import ChildrenMaskMethods from '../../../../plugins/gameobjects/container/containerlite/mask/ChildrenMaskMethods.js';
|
7 |
-
|
8 |
-
var methods = {
|
9 |
-
getChildrenWidth: GetChildrenWidth,
|
10 |
-
getChildrenHeight: GetChildrenHeight,
|
11 |
-
getChildrenSizers: GetChildrenSizers,
|
12 |
-
resetChildPosition: ResetChildPosition,
|
13 |
-
layoutChildren: LayoutChildren
|
14 |
-
};
|
15 |
-
|
16 |
-
Object.assign(
|
17 |
-
methods,
|
18 |
-
ChildrenMaskMethods
|
19 |
-
);
|
20 |
-
|
21 |
-
export default methods;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Ajitku/BTMLabs/README.md
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
---
|
2 |
-
title: BTMLabs
|
3 |
-
emoji: 📊
|
4 |
-
colorFrom: red
|
5 |
-
colorTo: indigo
|
6 |
-
sdk: gradio
|
7 |
-
sdk_version: 3.41.2
|
8 |
-
app_file: app.py
|
9 |
-
pinned: false
|
10 |
-
---
|
11 |
-
|
12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Akshay-More-007/starcoder/README.md
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
---
|
2 |
-
title: Starcoder
|
3 |
-
emoji: 👁
|
4 |
-
colorFrom: purple
|
5 |
-
colorTo: green
|
6 |
-
sdk: streamlit
|
7 |
-
sdk_version: 1.21.0
|
8 |
-
app_file: app.py
|
9 |
-
pinned: false
|
10 |
-
license: openrail
|
11 |
-
---
|
12 |
-
|
13 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/docs/source/ko/quicktour.md
DELETED
@@ -1,123 +0,0 @@
|
|
1 |
-
<!--Copyright 2023 The HuggingFace Team. All rights reserved.
|
2 |
-
|
3 |
-
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
|
4 |
-
the License. You may obtain a copy of the License at
|
5 |
-
|
6 |
-
http://www.apache.org/licenses/LICENSE-2.0
|
7 |
-
|
8 |
-
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
|
9 |
-
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
10 |
-
specific language governing permissions and limitations under the License.
|
11 |
-
-->
|
12 |
-
|
13 |
-
# 훑어보기
|
14 |
-
|
15 |
-
🧨 Diffusers로 빠르게 시작하고 실행하세요!
|
16 |
-
이 훑어보기는 여러분이 개발자, 일반사용자 상관없이 시작하는 데 도움을 주며, 추론을 위해 [`DiffusionPipeline`] 사용하는 방법을 보여줍니다.
|
17 |
-
|
18 |
-
시작하기에 앞서서, 필요한 모든 라이브러리가 설치되어 있는지 확인하세요:
|
19 |
-
|
20 |
-
```bash
|
21 |
-
pip install --upgrade diffusers accelerate transformers
|
22 |
-
```
|
23 |
-
|
24 |
-
- [`accelerate`](https://huggingface.co/docs/accelerate/index)은 추론 및 학습을 위한 모델 불러오기 속도를 높입니다.
|
25 |
-
- [`transformers`](https://huggingface.co/docs/transformers/index)는 [Stable Diffusion](https://huggingface.co/docs/diffusers/api/pipelines/stable_diffusion/overview)과 같이 가장 널리 사용되는 확산 모델을 실행하기 위해 필요합니다.
|
26 |
-
|
27 |
-
## DiffusionPipeline
|
28 |
-
|
29 |
-
[`DiffusionPipeline`]은 추론을 위해 사전학습된 확산 시스템을 사용하는 가장 쉬운 방법입니다. 다양한 양식의 많은 작업에 [`DiffusionPipeline`]을 바로 사용할 수 있습니다. 지원되는 작업은 아래의 표를 참고하세요:
|
30 |
-
|
31 |
-
| **Task** | **Description** | **Pipeline**
|
32 |
-
|------------------------------|--------------------------------------------------------------------------------------------------------------|-----------------|
|
33 |
-
| Unconditional Image Generation | 가우시안 노이즈에서 이미지 생성 | [unconditional_image_generation](./using-diffusers/unconditional_image_generation`) |
|
34 |
-
| Text-Guided Image Generation | 텍스트 프롬프트로 이미지 생성 | [conditional_image_generation](./using-diffusers/conditional_image_generation) |
|
35 |
-
| Text-Guided Image-to-Image Translation | 텍스트 프롬프트에 따라 이미지 조정 | [img2img](./using-diffusers/img2img) |
|
36 |
-
| Text-Guided Image-Inpainting | 마스크 및 텍스트 프롬프트가 주어진 이미지의 마스킹된 부분을 채우기 | [inpaint](./using-diffusers/inpaint) |
|
37 |
-
| Text-Guided Depth-to-Image Translation | 깊이 추정을 통해 구조를 유지하면서 텍스트 프롬프트에 따라 이미지의 일부를 조정 | [depth2image](./using-diffusers/depth2image) |
|
38 |
-
|
39 |
-
확산 파이프라인이 다양한 작업에 대해 어떻게 작동하는지는 [**Using Diffusers**](./using-diffusers/overview)를 참고하세요.
|
40 |
-
|
41 |
-
예를들어, [`DiffusionPipeline`] 인스턴스를 생성하여 시작하고, 다운로드하려는 파이프라인 체크포인트를 지정합니다.
|
42 |
-
모든 [Diffusers' checkpoint](https://huggingface.co/models?library=diffusers&sort=downloads)에 대해 [`DiffusionPipeline`]을 사용할 수 있습니다.
|
43 |
-
하지만, 이 가이드에서는 [Stable Diffusion](https://huggingface.co/CompVis/stable-diffusion)을 사용하여 text-to-image를 하는데 [`DiffusionPipeline`]을 사용합니다.
|
44 |
-
|
45 |
-
[Stable Diffusion](https://huggingface.co/CompVis/stable-diffusion) 기반 모델을 실행하기 전에 [license](https://huggingface.co/spaces/CompVis/stable-diffusion-license)를 주의 깊게 읽으세요.
|
46 |
-
이는 모델의 향상된 이미지 생성 기능과 이것으로 생성될 수 있는 유해한 콘텐츠 때문입니다. 선택한 Stable Diffusion 모델(*예*: [`runwayml/stable-diffusion-v1-5`](https://huggingface.co/runwayml/stable-diffusion-v1-5))로 이동하여 라이센스를 읽으세요.
|
47 |
-
|
48 |
-
다음과 같이 모델을 로드할 수 있습니다:
|
49 |
-
|
50 |
-
```python
|
51 |
-
>>> from diffusers import DiffusionPipeline
|
52 |
-
|
53 |
-
>>> pipeline = DiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5")
|
54 |
-
```
|
55 |
-
|
56 |
-
[`DiffusionPipeline`]은 모든 모델링, 토큰화 및 스케줄링 구성요소를 다운로드하고 캐시합니다.
|
57 |
-
모델은 약 14억개의 매개변수로 구성되어 있으므로 GPU에서 실행하는 것이 좋습니다.
|
58 |
-
PyTorch에서와 마찬가지로 생성기 객체를 GPU로 옮길 수 있습니다.
|
59 |
-
|
60 |
-
```python
|
61 |
-
>>> pipeline.to("cuda")
|
62 |
-
```
|
63 |
-
|
64 |
-
이제 `pipeline`을 사용할 수 있습니다:
|
65 |
-
|
66 |
-
```python
|
67 |
-
>>> image = pipeline("An image of a squirrel in Picasso style").images[0]
|
68 |
-
```
|
69 |
-
|
70 |
-
출력은 기본적으로 [PIL Image object](https://pillow.readthedocs.io/en/stable/reference/Image.html?highlight=image#the-image-class)로 래핑됩니다.
|
71 |
-
|
72 |
-
다음과 같이 함수를 호출하여 이미지를 저장할 수 있습니다:
|
73 |
-
|
74 |
-
```python
|
75 |
-
>>> image.save("image_of_squirrel_painting.png")
|
76 |
-
```
|
77 |
-
|
78 |
-
**참고**: 다음을 통해 가중치를 다운로드하여 로컬에서 파이프라인을 사용할 수도 있습니다:
|
79 |
-
|
80 |
-
```
|
81 |
-
git lfs install
|
82 |
-
git clone https://huggingface.co/runwayml/stable-diffusion-v1-5
|
83 |
-
```
|
84 |
-
|
85 |
-
그리고 저장된 가중치를 파이프라인에 불러옵니다.
|
86 |
-
|
87 |
-
```python
|
88 |
-
>>> pipeline = DiffusionPipeline.from_pretrained("./stable-diffusion-v1-5")
|
89 |
-
```
|
90 |
-
|
91 |
-
파이프라인 실행은 동일한 모델 아키텍처이므로 위의 코드와 동일합니다.
|
92 |
-
|
93 |
-
```python
|
94 |
-
>>> generator.to("cuda")
|
95 |
-
>>> image = generator("An image of a squirrel in Picasso style").images[0]
|
96 |
-
>>> image.save("image_of_squirrel_painting.png")
|
97 |
-
```
|
98 |
-
|
99 |
-
확산 시스템은 각각 장점이 있는 여러 다른 [schedulers](./api/schedulers/overview)와 함께 사용할 수 있습니다. 기본적으로 Stable Diffusion은 `PNDMScheduler`로 실행되지만 다른 스케줄러를 사용하는 방법은 매우 간단합니다. *예* [`EulerDiscreteScheduler`] 스케줄러를 사용하려는 경우, 다음과 같이 사용할 수 있습니다:
|
100 |
-
|
101 |
-
```python
|
102 |
-
>>> from diffusers import EulerDiscreteScheduler
|
103 |
-
|
104 |
-
>>> pipeline = StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5")
|
105 |
-
|
106 |
-
>>> # change scheduler to Euler
|
107 |
-
>>> pipeline.scheduler = EulerDiscreteScheduler.from_config(pipeline.scheduler.config)
|
108 |
-
```
|
109 |
-
|
110 |
-
스케줄러 변경 방법에 대한 자세한 내용은 [Using Schedulers](./using-diffusers/schedulers) 가이드를 참고하세요.
|
111 |
-
|
112 |
-
[Stability AI's](https://stability.ai/)의 Stable Diffusion 모델은 인상적인 이미지 생성 모델이며 텍스트에서 이미지를 생성하는 것보다 훨씬 더 많은 작업을 수행할 수 있습니다. 우리는 Stable Diffusion만을 위한 전체 문서 페이지를 제공합니다 [link](./conceptual/stable_diffusion).
|
113 |
-
|
114 |
-
만약 더 적은 메모리, 더 높은 추론 속도, Mac과 같은 특정 하드웨어 또는 ONNX 런타임에서 실행되도록 Stable Diffusion을 최적화하는 방법을 알고 싶다면 최적화 페이지를 살펴보세요:
|
115 |
-
|
116 |
-
- [Optimized PyTorch on GPU](./optimization/fp16)
|
117 |
-
- [Mac OS with PyTorch](./optimization/mps)
|
118 |
-
- [ONNX](./optimization/onnx)
|
119 |
-
- [OpenVINO](./optimization/open_vino)
|
120 |
-
|
121 |
-
확산 모델을 미세조정하거나 학습시키려면, [**training section**](./training/overview)을 살펴보세요.
|
122 |
-
|
123 |
-
마지막으로, 생성된 이미지를 공개적으로 배포할 때 신중을 기해 주세요 🤗.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/src/diffusers/pipelines/stable_diffusion_xl/watermark.py
DELETED
@@ -1,36 +0,0 @@
|
|
1 |
-
import numpy as np
|
2 |
-
import torch
|
3 |
-
|
4 |
-
from ...utils import is_invisible_watermark_available
|
5 |
-
|
6 |
-
|
7 |
-
if is_invisible_watermark_available():
|
8 |
-
from imwatermark import WatermarkEncoder
|
9 |
-
|
10 |
-
|
11 |
-
# Copied from https://github.com/Stability-AI/generative-models/blob/613af104c6b85184091d42d374fef420eddb356d/scripts/demo/streamlit_helpers.py#L66
|
12 |
-
WATERMARK_MESSAGE = 0b101100111110110010010000011110111011000110011110
|
13 |
-
# bin(x)[2:] gives bits of x as str, use int to convert them to 0/1
|
14 |
-
WATERMARK_BITS = [int(bit) for bit in bin(WATERMARK_MESSAGE)[2:]]
|
15 |
-
|
16 |
-
|
17 |
-
class StableDiffusionXLWatermarker:
|
18 |
-
def __init__(self):
|
19 |
-
self.watermark = WATERMARK_BITS
|
20 |
-
self.encoder = WatermarkEncoder()
|
21 |
-
|
22 |
-
self.encoder.set_watermark("bits", self.watermark)
|
23 |
-
|
24 |
-
def apply_watermark(self, images: torch.FloatTensor):
|
25 |
-
# can't encode images that are smaller than 256
|
26 |
-
if images.shape[-1] < 256:
|
27 |
-
return images
|
28 |
-
|
29 |
-
images = (255 * (images / 2 + 0.5)).cpu().permute(0, 2, 3, 1).float().numpy()
|
30 |
-
|
31 |
-
images = [self.encoder.encode(image, "dwtDct") for image in images]
|
32 |
-
|
33 |
-
images = torch.from_numpy(np.array(images)).permute(0, 3, 1, 2)
|
34 |
-
|
35 |
-
images = torch.clamp(2 * (images / 255 - 0.5), min=-1.0, max=1.0)
|
36 |
-
return images
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Andy1621/uniformer_image_detection/configs/vfnet/README.md
DELETED
@@ -1,43 +0,0 @@
|
|
1 |
-
# VarifocalNet: An IoU-aware Dense Object Detector
|
2 |
-
|
3 |
-
## Introduction
|
4 |
-
|
5 |
-
[ALGORITHM]
|
6 |
-
|
7 |
-
**VarifocalNet (VFNet)** learns to predict the IoU-aware classification score which mixes the object presence confidence and localization accuracy together as the detection score for a bounding box. The learning is supervised by the proposed Varifocal Loss (VFL), based on a new star-shaped bounding box feature representation (the features at nine yellow sampling points). Given the new representation, the object localization accuracy is further improved by refining the initially regressed bounding box. The full paper is available at: [https://arxiv.org/abs/2008.13367](https://arxiv.org/abs/2008.13367).
|
8 |
-
|
9 |
-
<div align="center">
|
10 |
-
<img src="https://user-images.githubusercontent.com/9102141/97464778-4b9ab000-197c-11eb-9283-ab2907ee0252.png" width="600px" />
|
11 |
-
<p>Learning to Predict the IoU-aware Classification Score.</p>
|
12 |
-
</div>
|
13 |
-
|
14 |
-
## Citing VarifocalNet
|
15 |
-
|
16 |
-
```latex
|
17 |
-
@article{zhang2020varifocalnet,
|
18 |
-
title={VarifocalNet: An IoU-aware Dense Object Detector},
|
19 |
-
author={Zhang, Haoyang and Wang, Ying and Dayoub, Feras and S{\"u}nderhauf, Niko},
|
20 |
-
journal={arXiv preprint arXiv:2008.13367},
|
21 |
-
year={2020}
|
22 |
-
}
|
23 |
-
```
|
24 |
-
|
25 |
-
## Results and Models
|
26 |
-
|
27 |
-
| Backbone | Style | DCN | MS train | Lr schd |Inf time (fps) | box AP (val) | box AP (test-dev) | Config | Download |
|
28 |
-
|:------------:|:---------:|:-------:|:--------:|:-------:|:-------------:|:------------:|:-----------------:|:------:|:--------:|
|
29 |
-
| R-50 | pytorch | N | N | 1x | - | 41.6 | 41.6 | [config](https://github.com/open-mmlab/mmdetection/blob/master/configs/vfnet_r50_fpn_1x_coco.py) | [model](https://openmmlab.oss-cn-hangzhou.aliyuncs.com/mmdetection/v2.0/vfnet/vfnet_r50_fpn_1x_coco/vfnet_r50_fpn_1x_coco_20201027-38db6f58.pth) | [log](https://openmmlab.oss-cn-hangzhou.aliyuncs.com/mmdetection/v2.0/vfnet/vfnet_r50_fpn_1x_coco/vfnet_r50_fpn_1x_coco.json)|
|
30 |
-
| R-50 | pytorch | N | Y | 2x | - | 44.5 | 44.8 | [config](https://github.com/open-mmlab/mmdetection/blob/master/configs/vfnet_r50_fpn_mstrain_2x_coco.py) | [model](https://openmmlab.oss-cn-hangzhou.aliyuncs.com/mmdetection/v2.0/vfnet/vfnet_r50_fpn_mstrain_2x_coco/vfnet_r50_fpn_mstrain_2x_coco_20201027-7cc75bd2.pth) | [log](https://openmmlab.oss-cn-hangzhou.aliyuncs.com/mmdetection/v2.0/vfnet/vfnet_r50_fpn_mstrain_2x_coco/vfnet_r50_fpn_mstrain_2x_coco.json)|
|
31 |
-
| R-50 | pytorch | Y | Y | 2x | - | 47.8 | 48.0 | [config](https://github.com/open-mmlab/mmdetection/blob/master/configs/vfnet_r50_fpn_mdconv_c3-c5_mstrain_2x_coco.py) | [model](https://openmmlab.oss-cn-hangzhou.aliyuncs.com/mmdetection/v2.0/vfnet/vfnet_r50_fpn_mdconv_c3-c5_mstrain_2x_coco/vfnet_r50_fpn_mdconv_c3-c5_mstrain_2x_coco_20201027pth-6879c318.pth) | [log](https://openmmlab.oss-cn-hangzhou.aliyuncs.com/mmdetection/v2.0/vfnet/vfnet_r50_fpn_mdconv_c3-c5_mstrain_2x_coco/vfnet_r50_fpn_mdconv_c3-c5_mstrain_2x_coco.json)|
|
32 |
-
| R-101 | pytorch | N | N | 1x | - | 43.0 | 43.6 | [config](https://github.com/open-mmlab/mmdetection/blob/master/configs/vfnet_r101_fpn_1x_coco.py) | [model](https://openmmlab.oss-cn-hangzhou.aliyuncs.com/mmdetection/v2.0/vfnet/vfnet_r101_fpn_1x_coco/vfnet_r101_fpn_1x_coco_20201027pth-c831ece7.pth) | [log](https://openmmlab.oss-cn-hangzhou.aliyuncs.com/mmdetection/v2.0/vfnet/vfnet_r101_fpn_1x_coco/vfnet_r101_fpn_1x_coco.json)|
|
33 |
-
| R-101 | pytorch | N | Y | 2x | - | 46.2 | 46.7 | [config](https://github.com/open-mmlab/mmdetection/blob/master/configs/vfnet_r101_fpn_mstrain_2x_coco.py) | [model](https://openmmlab.oss-cn-hangzhou.aliyuncs.com/mmdetection/v2.0/vfnet/vfnet_r101_fpn_mstrain_2x_coco/vfnet_r101_fpn_mstrain_2x_coco_20201027pth-4a5d53f1.pth) | [log](https://openmmlab.oss-cn-hangzhou.aliyuncs.com/mmdetection/v2.0/vfnet/vfnet_r101_fpn_mstrain_2x_coco/vfnet_r101_fpn_mstrain_2x_coco.json)|
|
34 |
-
| R-101 | pytorch | Y | Y | 2x | - | 49.0 | 49.2 | [config](https://github.com/open-mmlab/mmdetection/blob/master/configs/vfnet_r101_fpn_mdconv_c3-c5_mstrain_2x_coco.py) | [model](https://openmmlab.oss-cn-hangzhou.aliyuncs.com/mmdetection/v2.0/vfnet/vfnet_r101_fpn_mdconv_c3-c5_mstrain_2x_coco/vfnet_r101_fpn_mdconv_c3-c5_mstrain_2x_coco_20201027pth-7729adb5.pth) | [log](https://openmmlab.oss-cn-hangzhou.aliyuncs.com/mmdetection/v2.0/vfnet/vfnet_r101_fpn_mdconv_c3-c5_mstrain_2x_coco/vfnet_r101_fpn_mdconv_c3-c5_mstrain_2x_coco.json)|
|
35 |
-
| X-101-32x4d | pytorch | Y | Y | 2x | - | 49.7 | 50.0 | [config](https://github.com/open-mmlab/mmdetection/blob/master/configs/vfnet_x101_32x4d_fpn_mdconv_c3-c5_mstrain_2x_coco.py) | [model](https://openmmlab.oss-cn-hangzhou.aliyuncs.com/mmdetection/v2.0/vfnet/vfnet_x101_32x4d_fpn_mdconv_c3-c5_mstrain_2x_coco/vfnet_x101_32x4d_fpn_mdconv_c3-c5_mstrain_2x_coco_20201027pth-d300a6fc.pth) | [log](https://openmmlab.oss-cn-hangzhou.aliyuncs.com/mmdetection/v2.0/vfnet/vfnet_x101_32x4d_fpn_mdconv_c3-c5_mstrain_2x_coco/vfnet_x101_32x4d_fpn_mdconv_c3-c5_mstrain_2x_coco.json)|
|
36 |
-
| X-101-64x4d | pytorch | Y | Y | 2x | - | 50.4 | 50.8 | [config](https://github.com/open-mmlab/mmdetection/blob/master/configs/vfnet_x101_64x4d_fpn_mdconv_c3-c5_mstrain_2x_coco.py) | [model](https://openmmlab.oss-cn-hangzhou.aliyuncs.com/mmdetection/v2.0/vfnet/vfnet_x101_64x4d_fpn_mdconv_c3-c5_mstrain_2x_coco/vfnet_x101_64x4d_fpn_mdconv_c3-c5_mstrain_2x_coco_20201027pth-b5f6da5e.pth) | [log](https://openmmlab.oss-cn-hangzhou.aliyuncs.com/mmdetection/v2.0/vfnet/vfnet_x101_64x4d_fpn_mdconv_c3-c5_mstrain_2x_coco/vfnet_x101_64x4d_fpn_mdconv_c3-c5_mstrain_2x_coco.json)|
|
37 |
-
|
38 |
-
**Notes:**
|
39 |
-
|
40 |
-
- The MS-train scale range is 1333x[480:960] (`range` mode) and the inference scale keeps 1333x800.
|
41 |
-
- DCN means using `DCNv2` in both backbone and head.
|
42 |
-
- Inference time will be updated soon.
|
43 |
-
- More results and pre-trained models can be found in [VarifocalNet-Github](https://github.com/hyz-xmaster/VarifocalNet)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Andy1621/uniformer_image_segmentation/configs/ccnet/ccnet_r101-d8_512x512_160k_ade20k.py
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
_base_ = './ccnet_r50-d8_512x512_160k_ade20k.py'
|
2 |
-
model = dict(pretrained='open-mmlab://resnet101_v1c', backbone=dict(depth=101))
|
|
|
|
|
|
spaces/Andy1621/uniformer_image_segmentation/configs/deeplabv3/deeplabv3_r50-d8_480x480_40k_pascal_context_59.py
DELETED
@@ -1,10 +0,0 @@
|
|
1 |
-
_base_ = [
|
2 |
-
'../_base_/models/deeplabv3_r50-d8.py',
|
3 |
-
'../_base_/datasets/pascal_context_59.py', '../_base_/default_runtime.py',
|
4 |
-
'../_base_/schedules/schedule_40k.py'
|
5 |
-
]
|
6 |
-
model = dict(
|
7 |
-
decode_head=dict(num_classes=59),
|
8 |
-
auxiliary_head=dict(num_classes=59),
|
9 |
-
test_cfg=dict(mode='slide', crop_size=(480, 480), stride=(320, 320)))
|
10 |
-
optimizer = dict(type='SGD', lr=0.004, momentum=0.9, weight_decay=0.0001)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Anonymous-sub/Rerender/ControlNet/annotator/uniformer/mmcv/ops/roi_pool.py
DELETED
@@ -1,86 +0,0 @@
|
|
1 |
-
# Copyright (c) OpenMMLab. All rights reserved.
|
2 |
-
import torch
|
3 |
-
import torch.nn as nn
|
4 |
-
from torch.autograd import Function
|
5 |
-
from torch.autograd.function import once_differentiable
|
6 |
-
from torch.nn.modules.utils import _pair
|
7 |
-
|
8 |
-
from ..utils import ext_loader
|
9 |
-
|
10 |
-
ext_module = ext_loader.load_ext('_ext',
|
11 |
-
['roi_pool_forward', 'roi_pool_backward'])
|
12 |
-
|
13 |
-
|
14 |
-
class RoIPoolFunction(Function):
|
15 |
-
|
16 |
-
@staticmethod
|
17 |
-
def symbolic(g, input, rois, output_size, spatial_scale):
|
18 |
-
return g.op(
|
19 |
-
'MaxRoiPool',
|
20 |
-
input,
|
21 |
-
rois,
|
22 |
-
pooled_shape_i=output_size,
|
23 |
-
spatial_scale_f=spatial_scale)
|
24 |
-
|
25 |
-
@staticmethod
|
26 |
-
def forward(ctx, input, rois, output_size, spatial_scale=1.0):
|
27 |
-
ctx.output_size = _pair(output_size)
|
28 |
-
ctx.spatial_scale = spatial_scale
|
29 |
-
ctx.input_shape = input.size()
|
30 |
-
|
31 |
-
assert rois.size(1) == 5, 'RoI must be (idx, x1, y1, x2, y2)!'
|
32 |
-
|
33 |
-
output_shape = (rois.size(0), input.size(1), ctx.output_size[0],
|
34 |
-
ctx.output_size[1])
|
35 |
-
output = input.new_zeros(output_shape)
|
36 |
-
argmax = input.new_zeros(output_shape, dtype=torch.int)
|
37 |
-
|
38 |
-
ext_module.roi_pool_forward(
|
39 |
-
input,
|
40 |
-
rois,
|
41 |
-
output,
|
42 |
-
argmax,
|
43 |
-
pooled_height=ctx.output_size[0],
|
44 |
-
pooled_width=ctx.output_size[1],
|
45 |
-
spatial_scale=ctx.spatial_scale)
|
46 |
-
|
47 |
-
ctx.save_for_backward(rois, argmax)
|
48 |
-
return output
|
49 |
-
|
50 |
-
@staticmethod
|
51 |
-
@once_differentiable
|
52 |
-
def backward(ctx, grad_output):
|
53 |
-
rois, argmax = ctx.saved_tensors
|
54 |
-
grad_input = grad_output.new_zeros(ctx.input_shape)
|
55 |
-
|
56 |
-
ext_module.roi_pool_backward(
|
57 |
-
grad_output,
|
58 |
-
rois,
|
59 |
-
argmax,
|
60 |
-
grad_input,
|
61 |
-
pooled_height=ctx.output_size[0],
|
62 |
-
pooled_width=ctx.output_size[1],
|
63 |
-
spatial_scale=ctx.spatial_scale)
|
64 |
-
|
65 |
-
return grad_input, None, None, None
|
66 |
-
|
67 |
-
|
68 |
-
roi_pool = RoIPoolFunction.apply
|
69 |
-
|
70 |
-
|
71 |
-
class RoIPool(nn.Module):
|
72 |
-
|
73 |
-
def __init__(self, output_size, spatial_scale=1.0):
|
74 |
-
super(RoIPool, self).__init__()
|
75 |
-
|
76 |
-
self.output_size = _pair(output_size)
|
77 |
-
self.spatial_scale = float(spatial_scale)
|
78 |
-
|
79 |
-
def forward(self, input, rois):
|
80 |
-
return roi_pool(input, rois, self.output_size, self.spatial_scale)
|
81 |
-
|
82 |
-
def __repr__(self):
|
83 |
-
s = self.__class__.__name__
|
84 |
-
s += f'(output_size={self.output_size}, '
|
85 |
-
s += f'spatial_scale={self.spatial_scale})'
|
86 |
-
return s
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/AquaSuisei/ChatGPTXE/modules/presets.py
DELETED
@@ -1,198 +0,0 @@
|
|
1 |
-
# -*- coding:utf-8 -*-
|
2 |
-
import gradio as gr
|
3 |
-
from pathlib import Path
|
4 |
-
|
5 |
-
# ChatGPT 设置
|
6 |
-
initial_prompt = "You are a helpful assistant."
|
7 |
-
API_HOST = "api.openai.com"
|
8 |
-
COMPLETION_URL = "https://api.openai.com/v1/chat/completions"
|
9 |
-
BALANCE_API_URL="https://api.openai.com/dashboard/billing/credit_grants"
|
10 |
-
USAGE_API_URL="https://api.openai.com/dashboard/billing/usage"
|
11 |
-
HISTORY_DIR = Path("history")
|
12 |
-
TEMPLATES_DIR = "templates"
|
13 |
-
|
14 |
-
# 错误信息
|
15 |
-
standard_error_msg = "☹️发生了错误:" # 错误信息的标准前缀
|
16 |
-
error_retrieve_prompt = "请检查网络连接,或者API-Key是否有效。" # 获取对话时发生错误
|
17 |
-
connection_timeout_prompt = "连接超时,无法获取对话。" # 连接超时
|
18 |
-
read_timeout_prompt = "读取超时,无法获取对话。" # 读取超时
|
19 |
-
proxy_error_prompt = "代理错误,无法获取对话。" # 代理错误
|
20 |
-
ssl_error_prompt = "SSL错误,无法获取对话。" # SSL 错误
|
21 |
-
no_apikey_msg = "API key长度不是51位,请检查是否输入正确。" # API key 长度不足 51 位
|
22 |
-
no_input_msg = "请输入对话内容。" # 未输入对话内容
|
23 |
-
|
24 |
-
timeout_streaming = 30 # 流式对话时的超时时间
|
25 |
-
timeout_all = 200 # 非流式对话时的超时时间
|
26 |
-
enable_streaming_option = True # 是否启用选择选择是否实时显示回答的勾选框
|
27 |
-
HIDE_MY_KEY = False # 如果你想在UI中隐藏你的 API 密钥,将此值设置为 True
|
28 |
-
CONCURRENT_COUNT = 100 # 允许同时使用的用户数量
|
29 |
-
|
30 |
-
SIM_K = 5
|
31 |
-
INDEX_QUERY_TEMPRATURE = 1.0
|
32 |
-
|
33 |
-
title = """<h1 align="left" style="min-width:200px; margin-top:6px; white-space: nowrap;">川虎ChatGPT 🚀</h1>"""
|
34 |
-
description = """\
|
35 |
-
<div align="center" style="margin:16px 0">
|
36 |
-
|
37 |
-
由Bilibili [土川虎虎虎](https://space.bilibili.com/29125536) 和 [明昭MZhao](https://space.bilibili.com/24807452)开发
|
38 |
-
|
39 |
-
访问川虎ChatGPT的 [GitHub项目](https://github.com/GaiZhenbiao/ChuanhuChatGPT) 下载最新版脚本
|
40 |
-
|
41 |
-
此App使用 `gpt-3.5-turbo` 大语言模型
|
42 |
-
</div>
|
43 |
-
"""
|
44 |
-
|
45 |
-
footer = """\
|
46 |
-
<div class="versions">{versions}</div>
|
47 |
-
"""
|
48 |
-
|
49 |
-
summarize_prompt = "你是谁?我们刚才聊了什么?" # 总结对话时的 prompt
|
50 |
-
|
51 |
-
MODELS = [
|
52 |
-
"gpt-3.5-turbo",
|
53 |
-
"gpt-3.5-turbo-0301",
|
54 |
-
"gpt-4",
|
55 |
-
"gpt-4-0314",
|
56 |
-
"gpt-4-32k",
|
57 |
-
"gpt-4-32k-0314",
|
58 |
-
] # 可选的模型
|
59 |
-
|
60 |
-
MODEL_SOFT_TOKEN_LIMIT = {
|
61 |
-
"gpt-3.5-turbo": {
|
62 |
-
"streaming": 3500,
|
63 |
-
"all": 3500
|
64 |
-
},
|
65 |
-
"gpt-3.5-turbo-0301": {
|
66 |
-
"streaming": 3500,
|
67 |
-
"all": 3500
|
68 |
-
},
|
69 |
-
"gpt-4": {
|
70 |
-
"streaming": 7500,
|
71 |
-
"all": 7500
|
72 |
-
},
|
73 |
-
"gpt-4-0314": {
|
74 |
-
"streaming": 7500,
|
75 |
-
"all": 7500
|
76 |
-
},
|
77 |
-
"gpt-4-32k": {
|
78 |
-
"streaming": 31000,
|
79 |
-
"all": 31000
|
80 |
-
},
|
81 |
-
"gpt-4-32k-0314": {
|
82 |
-
"streaming": 31000,
|
83 |
-
"all": 31000
|
84 |
-
}
|
85 |
-
}
|
86 |
-
|
87 |
-
REPLY_LANGUAGES = [
|
88 |
-
"简体中文",
|
89 |
-
"繁體中文",
|
90 |
-
"English",
|
91 |
-
"日本語",
|
92 |
-
"Español",
|
93 |
-
"Français",
|
94 |
-
"Deutsch",
|
95 |
-
"跟随问题语言(不稳定)"
|
96 |
-
]
|
97 |
-
|
98 |
-
|
99 |
-
WEBSEARCH_PTOMPT_TEMPLATE = """\
|
100 |
-
Web search results:
|
101 |
-
|
102 |
-
{web_results}
|
103 |
-
Current date: {current_date}
|
104 |
-
|
105 |
-
Instructions: Using the provided web search results, write a comprehensive reply to the given query. Make sure to cite results using [[number](URL)] notation after the reference. If the provided search results refer to multiple subjects with the same name, write separate answers for each subject.
|
106 |
-
Query: {query}
|
107 |
-
Reply in {reply_language}
|
108 |
-
"""
|
109 |
-
|
110 |
-
PROMPT_TEMPLATE = """\
|
111 |
-
Context information is below.
|
112 |
-
---------------------
|
113 |
-
{context_str}
|
114 |
-
---------------------
|
115 |
-
Current date: {current_date}.
|
116 |
-
Using the provided context information, write a comprehensive reply to the given query.
|
117 |
-
Make sure to cite results using [number] notation after the reference.
|
118 |
-
If the provided context information refer to multiple subjects with the same name, write separate answers for each subject.
|
119 |
-
Use prior knowledge only if the given context didn't provide enough information.
|
120 |
-
Answer the question: {query_str}
|
121 |
-
Reply in {reply_language}
|
122 |
-
"""
|
123 |
-
|
124 |
-
REFINE_TEMPLATE = """\
|
125 |
-
The original question is as follows: {query_str}
|
126 |
-
We have provided an existing answer: {existing_answer}
|
127 |
-
We have the opportunity to refine the existing answer
|
128 |
-
(only if needed) with some more context below.
|
129 |
-
------------
|
130 |
-
{context_msg}
|
131 |
-
------------
|
132 |
-
Given the new context, refine the original answer to better
|
133 |
-
Reply in {reply_language}
|
134 |
-
If the context isn't useful, return the original answer.
|
135 |
-
"""
|
136 |
-
|
137 |
-
ALREADY_CONVERTED_MARK = "<!-- ALREADY CONVERTED BY PARSER. -->"
|
138 |
-
|
139 |
-
small_and_beautiful_theme = gr.themes.Soft(
|
140 |
-
primary_hue=gr.themes.Color(
|
141 |
-
c50="#02C160",
|
142 |
-
c100="rgba(2, 193, 96, 0.2)",
|
143 |
-
c200="#02C160",
|
144 |
-
c300="rgba(2, 193, 96, 0.32)",
|
145 |
-
c400="rgba(2, 193, 96, 0.32)",
|
146 |
-
c500="rgba(2, 193, 96, 1.0)",
|
147 |
-
c600="rgba(2, 193, 96, 1.0)",
|
148 |
-
c700="rgba(2, 193, 96, 0.32)",
|
149 |
-
c800="rgba(2, 193, 96, 0.32)",
|
150 |
-
c900="#02C160",
|
151 |
-
c950="#02C160",
|
152 |
-
),
|
153 |
-
secondary_hue=gr.themes.Color(
|
154 |
-
c50="#576b95",
|
155 |
-
c100="#576b95",
|
156 |
-
c200="#576b95",
|
157 |
-
c300="#576b95",
|
158 |
-
c400="#576b95",
|
159 |
-
c500="#576b95",
|
160 |
-
c600="#576b95",
|
161 |
-
c700="#576b95",
|
162 |
-
c800="#576b95",
|
163 |
-
c900="#576b95",
|
164 |
-
c950="#576b95",
|
165 |
-
),
|
166 |
-
neutral_hue=gr.themes.Color(
|
167 |
-
name="gray",
|
168 |
-
c50="#f9fafb",
|
169 |
-
c100="#f3f4f6",
|
170 |
-
c200="#e5e7eb",
|
171 |
-
c300="#d1d5db",
|
172 |
-
c400="#B2B2B2",
|
173 |
-
c500="#808080",
|
174 |
-
c600="#636363",
|
175 |
-
c700="#515151",
|
176 |
-
c800="#393939",
|
177 |
-
c900="#272727",
|
178 |
-
c950="#171717",
|
179 |
-
),
|
180 |
-
radius_size=gr.themes.sizes.radius_sm,
|
181 |
-
).set(
|
182 |
-
button_primary_background_fill="#06AE56",
|
183 |
-
button_primary_background_fill_dark="#06AE56",
|
184 |
-
button_primary_background_fill_hover="#07C863",
|
185 |
-
button_primary_border_color="#06AE56",
|
186 |
-
button_primary_border_color_dark="#06AE56",
|
187 |
-
button_primary_text_color="#FFFFFF",
|
188 |
-
button_primary_text_color_dark="#FFFFFF",
|
189 |
-
button_secondary_background_fill="#F2F2F2",
|
190 |
-
button_secondary_background_fill_dark="#2B2B2B",
|
191 |
-
button_secondary_text_color="#393939",
|
192 |
-
button_secondary_text_color_dark="#FFFFFF",
|
193 |
-
# background_fill_primary="#F7F7F7",
|
194 |
-
# background_fill_primary_dark="#1F1F1F",
|
195 |
-
block_title_text_color="*primary_500",
|
196 |
-
block_title_background_fill="*primary_100",
|
197 |
-
input_background_fill="#F6F6F6",
|
198 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/pip/_internal/cli/__init__.py
DELETED
@@ -1,4 +0,0 @@
|
|
1 |
-
"""Subpackage containing all of pip's command line interface related code
|
2 |
-
"""
|
3 |
-
|
4 |
-
# This file intentionally does not import submodules
|
|
|
|
|
|
|
|
|
|
spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/pkg_resources/_vendor/more_itertools/recipes.py
DELETED
@@ -1,698 +0,0 @@
|
|
1 |
-
"""Imported from the recipes section of the itertools documentation.
|
2 |
-
|
3 |
-
All functions taken from the recipes section of the itertools library docs
|
4 |
-
[1]_.
|
5 |
-
Some backward-compatible usability improvements have been made.
|
6 |
-
|
7 |
-
.. [1] http://docs.python.org/library/itertools.html#recipes
|
8 |
-
|
9 |
-
"""
|
10 |
-
import warnings
|
11 |
-
from collections import deque
|
12 |
-
from itertools import (
|
13 |
-
chain,
|
14 |
-
combinations,
|
15 |
-
count,
|
16 |
-
cycle,
|
17 |
-
groupby,
|
18 |
-
islice,
|
19 |
-
repeat,
|
20 |
-
starmap,
|
21 |
-
tee,
|
22 |
-
zip_longest,
|
23 |
-
)
|
24 |
-
import operator
|
25 |
-
from random import randrange, sample, choice
|
26 |
-
|
27 |
-
__all__ = [
|
28 |
-
'all_equal',
|
29 |
-
'before_and_after',
|
30 |
-
'consume',
|
31 |
-
'convolve',
|
32 |
-
'dotproduct',
|
33 |
-
'first_true',
|
34 |
-
'flatten',
|
35 |
-
'grouper',
|
36 |
-
'iter_except',
|
37 |
-
'ncycles',
|
38 |
-
'nth',
|
39 |
-
'nth_combination',
|
40 |
-
'padnone',
|
41 |
-
'pad_none',
|
42 |
-
'pairwise',
|
43 |
-
'partition',
|
44 |
-
'powerset',
|
45 |
-
'prepend',
|
46 |
-
'quantify',
|
47 |
-
'random_combination_with_replacement',
|
48 |
-
'random_combination',
|
49 |
-
'random_permutation',
|
50 |
-
'random_product',
|
51 |
-
'repeatfunc',
|
52 |
-
'roundrobin',
|
53 |
-
'sliding_window',
|
54 |
-
'tabulate',
|
55 |
-
'tail',
|
56 |
-
'take',
|
57 |
-
'triplewise',
|
58 |
-
'unique_everseen',
|
59 |
-
'unique_justseen',
|
60 |
-
]
|
61 |
-
|
62 |
-
|
63 |
-
def take(n, iterable):
|
64 |
-
"""Return first *n* items of the iterable as a list.
|
65 |
-
|
66 |
-
>>> take(3, range(10))
|
67 |
-
[0, 1, 2]
|
68 |
-
|
69 |
-
If there are fewer than *n* items in the iterable, all of them are
|
70 |
-
returned.
|
71 |
-
|
72 |
-
>>> take(10, range(3))
|
73 |
-
[0, 1, 2]
|
74 |
-
|
75 |
-
"""
|
76 |
-
return list(islice(iterable, n))
|
77 |
-
|
78 |
-
|
79 |
-
def tabulate(function, start=0):
|
80 |
-
"""Return an iterator over the results of ``func(start)``,
|
81 |
-
``func(start + 1)``, ``func(start + 2)``...
|
82 |
-
|
83 |
-
*func* should be a function that accepts one integer argument.
|
84 |
-
|
85 |
-
If *start* is not specified it defaults to 0. It will be incremented each
|
86 |
-
time the iterator is advanced.
|
87 |
-
|
88 |
-
>>> square = lambda x: x ** 2
|
89 |
-
>>> iterator = tabulate(square, -3)
|
90 |
-
>>> take(4, iterator)
|
91 |
-
[9, 4, 1, 0]
|
92 |
-
|
93 |
-
"""
|
94 |
-
return map(function, count(start))
|
95 |
-
|
96 |
-
|
97 |
-
def tail(n, iterable):
|
98 |
-
"""Return an iterator over the last *n* items of *iterable*.
|
99 |
-
|
100 |
-
>>> t = tail(3, 'ABCDEFG')
|
101 |
-
>>> list(t)
|
102 |
-
['E', 'F', 'G']
|
103 |
-
|
104 |
-
"""
|
105 |
-
return iter(deque(iterable, maxlen=n))
|
106 |
-
|
107 |
-
|
108 |
-
def consume(iterator, n=None):
|
109 |
-
"""Advance *iterable* by *n* steps. If *n* is ``None``, consume it
|
110 |
-
entirely.
|
111 |
-
|
112 |
-
Efficiently exhausts an iterator without returning values. Defaults to
|
113 |
-
consuming the whole iterator, but an optional second argument may be
|
114 |
-
provided to limit consumption.
|
115 |
-
|
116 |
-
>>> i = (x for x in range(10))
|
117 |
-
>>> next(i)
|
118 |
-
0
|
119 |
-
>>> consume(i, 3)
|
120 |
-
>>> next(i)
|
121 |
-
4
|
122 |
-
>>> consume(i)
|
123 |
-
>>> next(i)
|
124 |
-
Traceback (most recent call last):
|
125 |
-
File "<stdin>", line 1, in <module>
|
126 |
-
StopIteration
|
127 |
-
|
128 |
-
If the iterator has fewer items remaining than the provided limit, the
|
129 |
-
whole iterator will be consumed.
|
130 |
-
|
131 |
-
>>> i = (x for x in range(3))
|
132 |
-
>>> consume(i, 5)
|
133 |
-
>>> next(i)
|
134 |
-
Traceback (most recent call last):
|
135 |
-
File "<stdin>", line 1, in <module>
|
136 |
-
StopIteration
|
137 |
-
|
138 |
-
"""
|
139 |
-
# Use functions that consume iterators at C speed.
|
140 |
-
if n is None:
|
141 |
-
# feed the entire iterator into a zero-length deque
|
142 |
-
deque(iterator, maxlen=0)
|
143 |
-
else:
|
144 |
-
# advance to the empty slice starting at position n
|
145 |
-
next(islice(iterator, n, n), None)
|
146 |
-
|
147 |
-
|
148 |
-
def nth(iterable, n, default=None):
|
149 |
-
"""Returns the nth item or a default value.
|
150 |
-
|
151 |
-
>>> l = range(10)
|
152 |
-
>>> nth(l, 3)
|
153 |
-
3
|
154 |
-
>>> nth(l, 20, "zebra")
|
155 |
-
'zebra'
|
156 |
-
|
157 |
-
"""
|
158 |
-
return next(islice(iterable, n, None), default)
|
159 |
-
|
160 |
-
|
161 |
-
def all_equal(iterable):
|
162 |
-
"""
|
163 |
-
Returns ``True`` if all the elements are equal to each other.
|
164 |
-
|
165 |
-
>>> all_equal('aaaa')
|
166 |
-
True
|
167 |
-
>>> all_equal('aaab')
|
168 |
-
False
|
169 |
-
|
170 |
-
"""
|
171 |
-
g = groupby(iterable)
|
172 |
-
return next(g, True) and not next(g, False)
|
173 |
-
|
174 |
-
|
175 |
-
def quantify(iterable, pred=bool):
|
176 |
-
"""Return the how many times the predicate is true.
|
177 |
-
|
178 |
-
>>> quantify([True, False, True])
|
179 |
-
2
|
180 |
-
|
181 |
-
"""
|
182 |
-
return sum(map(pred, iterable))
|
183 |
-
|
184 |
-
|
185 |
-
def pad_none(iterable):
|
186 |
-
"""Returns the sequence of elements and then returns ``None`` indefinitely.
|
187 |
-
|
188 |
-
>>> take(5, pad_none(range(3)))
|
189 |
-
[0, 1, 2, None, None]
|
190 |
-
|
191 |
-
Useful for emulating the behavior of the built-in :func:`map` function.
|
192 |
-
|
193 |
-
See also :func:`padded`.
|
194 |
-
|
195 |
-
"""
|
196 |
-
return chain(iterable, repeat(None))
|
197 |
-
|
198 |
-
|
199 |
-
padnone = pad_none
|
200 |
-
|
201 |
-
|
202 |
-
def ncycles(iterable, n):
|
203 |
-
"""Returns the sequence elements *n* times
|
204 |
-
|
205 |
-
>>> list(ncycles(["a", "b"], 3))
|
206 |
-
['a', 'b', 'a', 'b', 'a', 'b']
|
207 |
-
|
208 |
-
"""
|
209 |
-
return chain.from_iterable(repeat(tuple(iterable), n))
|
210 |
-
|
211 |
-
|
212 |
-
def dotproduct(vec1, vec2):
|
213 |
-
"""Returns the dot product of the two iterables.
|
214 |
-
|
215 |
-
>>> dotproduct([10, 10], [20, 20])
|
216 |
-
400
|
217 |
-
|
218 |
-
"""
|
219 |
-
return sum(map(operator.mul, vec1, vec2))
|
220 |
-
|
221 |
-
|
222 |
-
def flatten(listOfLists):
|
223 |
-
"""Return an iterator flattening one level of nesting in a list of lists.
|
224 |
-
|
225 |
-
>>> list(flatten([[0, 1], [2, 3]]))
|
226 |
-
[0, 1, 2, 3]
|
227 |
-
|
228 |
-
See also :func:`collapse`, which can flatten multiple levels of nesting.
|
229 |
-
|
230 |
-
"""
|
231 |
-
return chain.from_iterable(listOfLists)
|
232 |
-
|
233 |
-
|
234 |
-
def repeatfunc(func, times=None, *args):
|
235 |
-
"""Call *func* with *args* repeatedly, returning an iterable over the
|
236 |
-
results.
|
237 |
-
|
238 |
-
If *times* is specified, the iterable will terminate after that many
|
239 |
-
repetitions:
|
240 |
-
|
241 |
-
>>> from operator import add
|
242 |
-
>>> times = 4
|
243 |
-
>>> args = 3, 5
|
244 |
-
>>> list(repeatfunc(add, times, *args))
|
245 |
-
[8, 8, 8, 8]
|
246 |
-
|
247 |
-
If *times* is ``None`` the iterable will not terminate:
|
248 |
-
|
249 |
-
>>> from random import randrange
|
250 |
-
>>> times = None
|
251 |
-
>>> args = 1, 11
|
252 |
-
>>> take(6, repeatfunc(randrange, times, *args)) # doctest:+SKIP
|
253 |
-
[2, 4, 8, 1, 8, 4]
|
254 |
-
|
255 |
-
"""
|
256 |
-
if times is None:
|
257 |
-
return starmap(func, repeat(args))
|
258 |
-
return starmap(func, repeat(args, times))
|
259 |
-
|
260 |
-
|
261 |
-
def _pairwise(iterable):
|
262 |
-
"""Returns an iterator of paired items, overlapping, from the original
|
263 |
-
|
264 |
-
>>> take(4, pairwise(count()))
|
265 |
-
[(0, 1), (1, 2), (2, 3), (3, 4)]
|
266 |
-
|
267 |
-
On Python 3.10 and above, this is an alias for :func:`itertools.pairwise`.
|
268 |
-
|
269 |
-
"""
|
270 |
-
a, b = tee(iterable)
|
271 |
-
next(b, None)
|
272 |
-
yield from zip(a, b)
|
273 |
-
|
274 |
-
|
275 |
-
try:
|
276 |
-
from itertools import pairwise as itertools_pairwise
|
277 |
-
except ImportError:
|
278 |
-
pairwise = _pairwise
|
279 |
-
else:
|
280 |
-
|
281 |
-
def pairwise(iterable):
|
282 |
-
yield from itertools_pairwise(iterable)
|
283 |
-
|
284 |
-
pairwise.__doc__ = _pairwise.__doc__
|
285 |
-
|
286 |
-
|
287 |
-
def grouper(iterable, n, fillvalue=None):
|
288 |
-
"""Collect data into fixed-length chunks or blocks.
|
289 |
-
|
290 |
-
>>> list(grouper('ABCDEFG', 3, 'x'))
|
291 |
-
[('A', 'B', 'C'), ('D', 'E', 'F'), ('G', 'x', 'x')]
|
292 |
-
|
293 |
-
"""
|
294 |
-
if isinstance(iterable, int):
|
295 |
-
warnings.warn(
|
296 |
-
"grouper expects iterable as first parameter", DeprecationWarning
|
297 |
-
)
|
298 |
-
n, iterable = iterable, n
|
299 |
-
args = [iter(iterable)] * n
|
300 |
-
return zip_longest(fillvalue=fillvalue, *args)
|
301 |
-
|
302 |
-
|
303 |
-
def roundrobin(*iterables):
|
304 |
-
"""Yields an item from each iterable, alternating between them.
|
305 |
-
|
306 |
-
>>> list(roundrobin('ABC', 'D', 'EF'))
|
307 |
-
['A', 'D', 'E', 'B', 'F', 'C']
|
308 |
-
|
309 |
-
This function produces the same output as :func:`interleave_longest`, but
|
310 |
-
may perform better for some inputs (in particular when the number of
|
311 |
-
iterables is small).
|
312 |
-
|
313 |
-
"""
|
314 |
-
# Recipe credited to George Sakkis
|
315 |
-
pending = len(iterables)
|
316 |
-
nexts = cycle(iter(it).__next__ for it in iterables)
|
317 |
-
while pending:
|
318 |
-
try:
|
319 |
-
for next in nexts:
|
320 |
-
yield next()
|
321 |
-
except StopIteration:
|
322 |
-
pending -= 1
|
323 |
-
nexts = cycle(islice(nexts, pending))
|
324 |
-
|
325 |
-
|
326 |
-
def partition(pred, iterable):
|
327 |
-
"""
|
328 |
-
Returns a 2-tuple of iterables derived from the input iterable.
|
329 |
-
The first yields the items that have ``pred(item) == False``.
|
330 |
-
The second yields the items that have ``pred(item) == True``.
|
331 |
-
|
332 |
-
>>> is_odd = lambda x: x % 2 != 0
|
333 |
-
>>> iterable = range(10)
|
334 |
-
>>> even_items, odd_items = partition(is_odd, iterable)
|
335 |
-
>>> list(even_items), list(odd_items)
|
336 |
-
([0, 2, 4, 6, 8], [1, 3, 5, 7, 9])
|
337 |
-
|
338 |
-
If *pred* is None, :func:`bool` is used.
|
339 |
-
|
340 |
-
>>> iterable = [0, 1, False, True, '', ' ']
|
341 |
-
>>> false_items, true_items = partition(None, iterable)
|
342 |
-
>>> list(false_items), list(true_items)
|
343 |
-
([0, False, ''], [1, True, ' '])
|
344 |
-
|
345 |
-
"""
|
346 |
-
if pred is None:
|
347 |
-
pred = bool
|
348 |
-
|
349 |
-
evaluations = ((pred(x), x) for x in iterable)
|
350 |
-
t1, t2 = tee(evaluations)
|
351 |
-
return (
|
352 |
-
(x for (cond, x) in t1 if not cond),
|
353 |
-
(x for (cond, x) in t2 if cond),
|
354 |
-
)
|
355 |
-
|
356 |
-
|
357 |
-
def powerset(iterable):
|
358 |
-
"""Yields all possible subsets of the iterable.
|
359 |
-
|
360 |
-
>>> list(powerset([1, 2, 3]))
|
361 |
-
[(), (1,), (2,), (3,), (1, 2), (1, 3), (2, 3), (1, 2, 3)]
|
362 |
-
|
363 |
-
:func:`powerset` will operate on iterables that aren't :class:`set`
|
364 |
-
instances, so repeated elements in the input will produce repeated elements
|
365 |
-
in the output. Use :func:`unique_everseen` on the input to avoid generating
|
366 |
-
duplicates:
|
367 |
-
|
368 |
-
>>> seq = [1, 1, 0]
|
369 |
-
>>> list(powerset(seq))
|
370 |
-
[(), (1,), (1,), (0,), (1, 1), (1, 0), (1, 0), (1, 1, 0)]
|
371 |
-
>>> from more_itertools import unique_everseen
|
372 |
-
>>> list(powerset(unique_everseen(seq)))
|
373 |
-
[(), (1,), (0,), (1, 0)]
|
374 |
-
|
375 |
-
"""
|
376 |
-
s = list(iterable)
|
377 |
-
return chain.from_iterable(combinations(s, r) for r in range(len(s) + 1))
|
378 |
-
|
379 |
-
|
380 |
-
def unique_everseen(iterable, key=None):
|
381 |
-
"""
|
382 |
-
Yield unique elements, preserving order.
|
383 |
-
|
384 |
-
>>> list(unique_everseen('AAAABBBCCDAABBB'))
|
385 |
-
['A', 'B', 'C', 'D']
|
386 |
-
>>> list(unique_everseen('ABBCcAD', str.lower))
|
387 |
-
['A', 'B', 'C', 'D']
|
388 |
-
|
389 |
-
Sequences with a mix of hashable and unhashable items can be used.
|
390 |
-
The function will be slower (i.e., `O(n^2)`) for unhashable items.
|
391 |
-
|
392 |
-
Remember that ``list`` objects are unhashable - you can use the *key*
|
393 |
-
parameter to transform the list to a tuple (which is hashable) to
|
394 |
-
avoid a slowdown.
|
395 |
-
|
396 |
-
>>> iterable = ([1, 2], [2, 3], [1, 2])
|
397 |
-
>>> list(unique_everseen(iterable)) # Slow
|
398 |
-
[[1, 2], [2, 3]]
|
399 |
-
>>> list(unique_everseen(iterable, key=tuple)) # Faster
|
400 |
-
[[1, 2], [2, 3]]
|
401 |
-
|
402 |
-
Similary, you may want to convert unhashable ``set`` objects with
|
403 |
-
``key=frozenset``. For ``dict`` objects,
|
404 |
-
``key=lambda x: frozenset(x.items())`` can be used.
|
405 |
-
|
406 |
-
"""
|
407 |
-
seenset = set()
|
408 |
-
seenset_add = seenset.add
|
409 |
-
seenlist = []
|
410 |
-
seenlist_add = seenlist.append
|
411 |
-
use_key = key is not None
|
412 |
-
|
413 |
-
for element in iterable:
|
414 |
-
k = key(element) if use_key else element
|
415 |
-
try:
|
416 |
-
if k not in seenset:
|
417 |
-
seenset_add(k)
|
418 |
-
yield element
|
419 |
-
except TypeError:
|
420 |
-
if k not in seenlist:
|
421 |
-
seenlist_add(k)
|
422 |
-
yield element
|
423 |
-
|
424 |
-
|
425 |
-
def unique_justseen(iterable, key=None):
|
426 |
-
"""Yields elements in order, ignoring serial duplicates
|
427 |
-
|
428 |
-
>>> list(unique_justseen('AAAABBBCCDAABBB'))
|
429 |
-
['A', 'B', 'C', 'D', 'A', 'B']
|
430 |
-
>>> list(unique_justseen('ABBCcAD', str.lower))
|
431 |
-
['A', 'B', 'C', 'A', 'D']
|
432 |
-
|
433 |
-
"""
|
434 |
-
return map(next, map(operator.itemgetter(1), groupby(iterable, key)))
|
435 |
-
|
436 |
-
|
437 |
-
def iter_except(func, exception, first=None):
|
438 |
-
"""Yields results from a function repeatedly until an exception is raised.
|
439 |
-
|
440 |
-
Converts a call-until-exception interface to an iterator interface.
|
441 |
-
Like ``iter(func, sentinel)``, but uses an exception instead of a sentinel
|
442 |
-
to end the loop.
|
443 |
-
|
444 |
-
>>> l = [0, 1, 2]
|
445 |
-
>>> list(iter_except(l.pop, IndexError))
|
446 |
-
[2, 1, 0]
|
447 |
-
|
448 |
-
Multiple exceptions can be specified as a stopping condition:
|
449 |
-
|
450 |
-
>>> l = [1, 2, 3, '...', 4, 5, 6]
|
451 |
-
>>> list(iter_except(lambda: 1 + l.pop(), (IndexError, TypeError)))
|
452 |
-
[7, 6, 5]
|
453 |
-
>>> list(iter_except(lambda: 1 + l.pop(), (IndexError, TypeError)))
|
454 |
-
[4, 3, 2]
|
455 |
-
>>> list(iter_except(lambda: 1 + l.pop(), (IndexError, TypeError)))
|
456 |
-
[]
|
457 |
-
|
458 |
-
"""
|
459 |
-
try:
|
460 |
-
if first is not None:
|
461 |
-
yield first()
|
462 |
-
while 1:
|
463 |
-
yield func()
|
464 |
-
except exception:
|
465 |
-
pass
|
466 |
-
|
467 |
-
|
468 |
-
def first_true(iterable, default=None, pred=None):
|
469 |
-
"""
|
470 |
-
Returns the first true value in the iterable.
|
471 |
-
|
472 |
-
If no true value is found, returns *default*
|
473 |
-
|
474 |
-
If *pred* is not None, returns the first item for which
|
475 |
-
``pred(item) == True`` .
|
476 |
-
|
477 |
-
>>> first_true(range(10))
|
478 |
-
1
|
479 |
-
>>> first_true(range(10), pred=lambda x: x > 5)
|
480 |
-
6
|
481 |
-
>>> first_true(range(10), default='missing', pred=lambda x: x > 9)
|
482 |
-
'missing'
|
483 |
-
|
484 |
-
"""
|
485 |
-
return next(filter(pred, iterable), default)
|
486 |
-
|
487 |
-
|
488 |
-
def random_product(*args, repeat=1):
|
489 |
-
"""Draw an item at random from each of the input iterables.
|
490 |
-
|
491 |
-
>>> random_product('abc', range(4), 'XYZ') # doctest:+SKIP
|
492 |
-
('c', 3, 'Z')
|
493 |
-
|
494 |
-
If *repeat* is provided as a keyword argument, that many items will be
|
495 |
-
drawn from each iterable.
|
496 |
-
|
497 |
-
>>> random_product('abcd', range(4), repeat=2) # doctest:+SKIP
|
498 |
-
('a', 2, 'd', 3)
|
499 |
-
|
500 |
-
This equivalent to taking a random selection from
|
501 |
-
``itertools.product(*args, **kwarg)``.
|
502 |
-
|
503 |
-
"""
|
504 |
-
pools = [tuple(pool) for pool in args] * repeat
|
505 |
-
return tuple(choice(pool) for pool in pools)
|
506 |
-
|
507 |
-
|
508 |
-
def random_permutation(iterable, r=None):
|
509 |
-
"""Return a random *r* length permutation of the elements in *iterable*.
|
510 |
-
|
511 |
-
If *r* is not specified or is ``None``, then *r* defaults to the length of
|
512 |
-
*iterable*.
|
513 |
-
|
514 |
-
>>> random_permutation(range(5)) # doctest:+SKIP
|
515 |
-
(3, 4, 0, 1, 2)
|
516 |
-
|
517 |
-
This equivalent to taking a random selection from
|
518 |
-
``itertools.permutations(iterable, r)``.
|
519 |
-
|
520 |
-
"""
|
521 |
-
pool = tuple(iterable)
|
522 |
-
r = len(pool) if r is None else r
|
523 |
-
return tuple(sample(pool, r))
|
524 |
-
|
525 |
-
|
526 |
-
def random_combination(iterable, r):
|
527 |
-
"""Return a random *r* length subsequence of the elements in *iterable*.
|
528 |
-
|
529 |
-
>>> random_combination(range(5), 3) # doctest:+SKIP
|
530 |
-
(2, 3, 4)
|
531 |
-
|
532 |
-
This equivalent to taking a random selection from
|
533 |
-
``itertools.combinations(iterable, r)``.
|
534 |
-
|
535 |
-
"""
|
536 |
-
pool = tuple(iterable)
|
537 |
-
n = len(pool)
|
538 |
-
indices = sorted(sample(range(n), r))
|
539 |
-
return tuple(pool[i] for i in indices)
|
540 |
-
|
541 |
-
|
542 |
-
def random_combination_with_replacement(iterable, r):
|
543 |
-
"""Return a random *r* length subsequence of elements in *iterable*,
|
544 |
-
allowing individual elements to be repeated.
|
545 |
-
|
546 |
-
>>> random_combination_with_replacement(range(3), 5) # doctest:+SKIP
|
547 |
-
(0, 0, 1, 2, 2)
|
548 |
-
|
549 |
-
This equivalent to taking a random selection from
|
550 |
-
``itertools.combinations_with_replacement(iterable, r)``.
|
551 |
-
|
552 |
-
"""
|
553 |
-
pool = tuple(iterable)
|
554 |
-
n = len(pool)
|
555 |
-
indices = sorted(randrange(n) for i in range(r))
|
556 |
-
return tuple(pool[i] for i in indices)
|
557 |
-
|
558 |
-
|
559 |
-
def nth_combination(iterable, r, index):
|
560 |
-
"""Equivalent to ``list(combinations(iterable, r))[index]``.
|
561 |
-
|
562 |
-
The subsequences of *iterable* that are of length *r* can be ordered
|
563 |
-
lexicographically. :func:`nth_combination` computes the subsequence at
|
564 |
-
sort position *index* directly, without computing the previous
|
565 |
-
subsequences.
|
566 |
-
|
567 |
-
>>> nth_combination(range(5), 3, 5)
|
568 |
-
(0, 3, 4)
|
569 |
-
|
570 |
-
``ValueError`` will be raised If *r* is negative or greater than the length
|
571 |
-
of *iterable*.
|
572 |
-
``IndexError`` will be raised if the given *index* is invalid.
|
573 |
-
"""
|
574 |
-
pool = tuple(iterable)
|
575 |
-
n = len(pool)
|
576 |
-
if (r < 0) or (r > n):
|
577 |
-
raise ValueError
|
578 |
-
|
579 |
-
c = 1
|
580 |
-
k = min(r, n - r)
|
581 |
-
for i in range(1, k + 1):
|
582 |
-
c = c * (n - k + i) // i
|
583 |
-
|
584 |
-
if index < 0:
|
585 |
-
index += c
|
586 |
-
|
587 |
-
if (index < 0) or (index >= c):
|
588 |
-
raise IndexError
|
589 |
-
|
590 |
-
result = []
|
591 |
-
while r:
|
592 |
-
c, n, r = c * r // n, n - 1, r - 1
|
593 |
-
while index >= c:
|
594 |
-
index -= c
|
595 |
-
c, n = c * (n - r) // n, n - 1
|
596 |
-
result.append(pool[-1 - n])
|
597 |
-
|
598 |
-
return tuple(result)
|
599 |
-
|
600 |
-
|
601 |
-
def prepend(value, iterator):
|
602 |
-
"""Yield *value*, followed by the elements in *iterator*.
|
603 |
-
|
604 |
-
>>> value = '0'
|
605 |
-
>>> iterator = ['1', '2', '3']
|
606 |
-
>>> list(prepend(value, iterator))
|
607 |
-
['0', '1', '2', '3']
|
608 |
-
|
609 |
-
To prepend multiple values, see :func:`itertools.chain`
|
610 |
-
or :func:`value_chain`.
|
611 |
-
|
612 |
-
"""
|
613 |
-
return chain([value], iterator)
|
614 |
-
|
615 |
-
|
616 |
-
def convolve(signal, kernel):
|
617 |
-
"""Convolve the iterable *signal* with the iterable *kernel*.
|
618 |
-
|
619 |
-
>>> signal = (1, 2, 3, 4, 5)
|
620 |
-
>>> kernel = [3, 2, 1]
|
621 |
-
>>> list(convolve(signal, kernel))
|
622 |
-
[3, 8, 14, 20, 26, 14, 5]
|
623 |
-
|
624 |
-
Note: the input arguments are not interchangeable, as the *kernel*
|
625 |
-
is immediately consumed and stored.
|
626 |
-
|
627 |
-
"""
|
628 |
-
kernel = tuple(kernel)[::-1]
|
629 |
-
n = len(kernel)
|
630 |
-
window = deque([0], maxlen=n) * n
|
631 |
-
for x in chain(signal, repeat(0, n - 1)):
|
632 |
-
window.append(x)
|
633 |
-
yield sum(map(operator.mul, kernel, window))
|
634 |
-
|
635 |
-
|
636 |
-
def before_and_after(predicate, it):
|
637 |
-
"""A variant of :func:`takewhile` that allows complete access to the
|
638 |
-
remainder of the iterator.
|
639 |
-
|
640 |
-
>>> it = iter('ABCdEfGhI')
|
641 |
-
>>> all_upper, remainder = before_and_after(str.isupper, it)
|
642 |
-
>>> ''.join(all_upper)
|
643 |
-
'ABC'
|
644 |
-
>>> ''.join(remainder) # takewhile() would lose the 'd'
|
645 |
-
'dEfGhI'
|
646 |
-
|
647 |
-
Note that the first iterator must be fully consumed before the second
|
648 |
-
iterator can generate valid results.
|
649 |
-
"""
|
650 |
-
it = iter(it)
|
651 |
-
transition = []
|
652 |
-
|
653 |
-
def true_iterator():
|
654 |
-
for elem in it:
|
655 |
-
if predicate(elem):
|
656 |
-
yield elem
|
657 |
-
else:
|
658 |
-
transition.append(elem)
|
659 |
-
return
|
660 |
-
|
661 |
-
def remainder_iterator():
|
662 |
-
yield from transition
|
663 |
-
yield from it
|
664 |
-
|
665 |
-
return true_iterator(), remainder_iterator()
|
666 |
-
|
667 |
-
|
668 |
-
def triplewise(iterable):
|
669 |
-
"""Return overlapping triplets from *iterable*.
|
670 |
-
|
671 |
-
>>> list(triplewise('ABCDE'))
|
672 |
-
[('A', 'B', 'C'), ('B', 'C', 'D'), ('C', 'D', 'E')]
|
673 |
-
|
674 |
-
"""
|
675 |
-
for (a, _), (b, c) in pairwise(pairwise(iterable)):
|
676 |
-
yield a, b, c
|
677 |
-
|
678 |
-
|
679 |
-
def sliding_window(iterable, n):
|
680 |
-
"""Return a sliding window of width *n* over *iterable*.
|
681 |
-
|
682 |
-
>>> list(sliding_window(range(6), 4))
|
683 |
-
[(0, 1, 2, 3), (1, 2, 3, 4), (2, 3, 4, 5)]
|
684 |
-
|
685 |
-
If *iterable* has fewer than *n* items, then nothing is yielded:
|
686 |
-
|
687 |
-
>>> list(sliding_window(range(3), 4))
|
688 |
-
[]
|
689 |
-
|
690 |
-
For a variant with more features, see :func:`windowed`.
|
691 |
-
"""
|
692 |
-
it = iter(iterable)
|
693 |
-
window = deque(islice(it, n), maxlen=n)
|
694 |
-
if len(window) == n:
|
695 |
-
yield tuple(window)
|
696 |
-
for x in it:
|
697 |
-
window.append(x)
|
698 |
-
yield tuple(window)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Awiny/Image2Paragraph/models/grit_src/third_party/CenterNet2/dev/packaging/pkg_helpers.bash
DELETED
@@ -1,76 +0,0 @@
|
|
1 |
-
#!/bin/bash -e
|
2 |
-
# Copyright (c) Facebook, Inc. and its affiliates.
|
3 |
-
|
4 |
-
# Function to retry functions that sometimes timeout or have flaky failures
|
5 |
-
retry () {
|
6 |
-
$* || (sleep 1 && $*) || (sleep 2 && $*) || (sleep 4 && $*) || (sleep 8 && $*)
|
7 |
-
}
|
8 |
-
# Install with pip a bit more robustly than the default
|
9 |
-
pip_install() {
|
10 |
-
retry pip install --progress-bar off "$@"
|
11 |
-
}
|
12 |
-
|
13 |
-
|
14 |
-
setup_cuda() {
|
15 |
-
# Now work out the CUDA settings
|
16 |
-
# Like other torch domain libraries, we choose common GPU architectures only.
|
17 |
-
# See https://github.com/pytorch/pytorch/blob/master/torch/utils/cpp_extension.py
|
18 |
-
# and https://github.com/pytorch/vision/blob/main/packaging/pkg_helpers.bash for reference.
|
19 |
-
export FORCE_CUDA=1
|
20 |
-
case "$CU_VERSION" in
|
21 |
-
cu113)
|
22 |
-
export CUDA_HOME=/usr/local/cuda-11.3/
|
23 |
-
export TORCH_CUDA_ARCH_LIST="3.7;5.0;5.2;6.0;6.1+PTX;7.0;7.5+PTX;8.0;8.6+PTX"
|
24 |
-
;;
|
25 |
-
cu112)
|
26 |
-
export CUDA_HOME=/usr/local/cuda-11.2/
|
27 |
-
export TORCH_CUDA_ARCH_LIST="3.7;5.0;5.2;6.0;6.1+PTX;7.0;7.5+PTX;8.0;8.6+PTX"
|
28 |
-
;;
|
29 |
-
cu111)
|
30 |
-
export CUDA_HOME=/usr/local/cuda-11.1/
|
31 |
-
export TORCH_CUDA_ARCH_LIST="3.7;5.0;5.2;6.0;6.1+PTX;7.0;7.5+PTX;8.0;8.6+PTX"
|
32 |
-
;;
|
33 |
-
cu110)
|
34 |
-
export CUDA_HOME=/usr/local/cuda-11.0/
|
35 |
-
export TORCH_CUDA_ARCH_LIST="3.7;5.0;5.2;6.0;6.1+PTX;7.0;7.5+PTX;8.0+PTX"
|
36 |
-
;;
|
37 |
-
cu102)
|
38 |
-
export CUDA_HOME=/usr/local/cuda-10.2/
|
39 |
-
export TORCH_CUDA_ARCH_LIST="3.7;5.0;5.2;6.0;6.1+PTX;7.0;7.5+PTX"
|
40 |
-
;;
|
41 |
-
cu101)
|
42 |
-
export CUDA_HOME=/usr/local/cuda-10.1/
|
43 |
-
export TORCH_CUDA_ARCH_LIST="3.7;5.0;5.2;6.0;6.1+PTX;7.0;7.5+PTX"
|
44 |
-
;;
|
45 |
-
cu100)
|
46 |
-
export CUDA_HOME=/usr/local/cuda-10.0/
|
47 |
-
export TORCH_CUDA_ARCH_LIST="3.7;5.0;5.2;6.0;6.1+PTX;7.0;7.5+PTX"
|
48 |
-
;;
|
49 |
-
cu92)
|
50 |
-
export CUDA_HOME=/usr/local/cuda-9.2/
|
51 |
-
export TORCH_CUDA_ARCH_LIST="3.7;5.0;5.2;6.0;6.1+PTX;7.0+PTX"
|
52 |
-
;;
|
53 |
-
cpu)
|
54 |
-
unset FORCE_CUDA
|
55 |
-
export CUDA_VISIBLE_DEVICES=
|
56 |
-
;;
|
57 |
-
*)
|
58 |
-
echo "Unrecognized CU_VERSION=$CU_VERSION"
|
59 |
-
exit 1
|
60 |
-
;;
|
61 |
-
esac
|
62 |
-
}
|
63 |
-
|
64 |
-
setup_wheel_python() {
|
65 |
-
case "$PYTHON_VERSION" in
|
66 |
-
3.6) python_abi=cp36-cp36m ;;
|
67 |
-
3.7) python_abi=cp37-cp37m ;;
|
68 |
-
3.8) python_abi=cp38-cp38 ;;
|
69 |
-
3.9) python_abi=cp39-cp39 ;;
|
70 |
-
*)
|
71 |
-
echo "Unrecognized PYTHON_VERSION=$PYTHON_VERSION"
|
72 |
-
exit 1
|
73 |
-
;;
|
74 |
-
esac
|
75 |
-
export PATH="/opt/python/$python_abi/bin:$PATH"
|
76 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/BAAI/AltDiffusion-m9/footer.html
DELETED
@@ -1,18 +0,0 @@
|
|
1 |
-
<div class="footer">
|
2 |
-
<p> - Model by <a href="https://github.com/FlagAI-Open/FlagAI"><img src="https://github-link-card.s3.ap-northeast-1.amazonaws.com/FlagAI-Open/FlagAI.png" width="1200px"></a > - Gradio Demo by 🤗 Hugging Face
|
3 |
-
</p>
|
4 |
-
<!-- <p><a href="https://github.com/FlagAI-Open/FlagAI"><img src="https://raw.githubusercontent.com/920232796/test/master/contributors.png" width="1200px"></a >
|
5 |
-
</p> -->
|
6 |
-
|
7 |
-
<div class="acknowledgments">
|
8 |
-
<p><h4 style="font-weight: bold; font-size: 20px; margin-top: 20px;">LICENSE</h4>
|
9 |
-
The model is licensed with a <a href="https://huggingface.co/spaces/CompVis/stable-diffusion-license" style="text-decoration: underline;" target="_blank">CreativeML Open RAIL-M</a> license. The authors claim no rights on the outputs you generate, you are free to use them and are accountable for their use which must not go against the provisions set in this license. The license forbids you from sharing any content that violates any laws, produce any harm to a person, disseminate any personal information that would be meant for harm, spread misinformation and target vulnerable groups. For the full list of restrictions please <a href="https://huggingface.co/spaces/CompVis/stable-diffusion-license" target="_blank" style="text-decoration: underline;" target="_blank">read the license</a>
|
10 |
-
</p>
|
11 |
-
|
12 |
-
<p><h4 style="font-weight: bold; font-size: 20px;">Contributing</h4>
|
13 |
-
Thanks for your interest in contributing! There are many ways to get involved; start with our <a href="https://github.com/FlagAI-Open/FlagAI" style="text-decoration: underline;" target="_blank">contributor guidelines</a> and then check these <a href="https://github.com/FlagAI-Open/FlagAI" style="text-decoration: underline;" target="_blank"> open issues</a> for specific tasks.
|
14 |
-
</p>
|
15 |
-
</div>
|
16 |
-
</div>
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/BAAI/vid2vid-zero/gradio_demo/style.css
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
h1 {
|
2 |
-
text-align: center;
|
3 |
-
}
|
|
|
|
|
|
|
|
spaces/Benson/text-generation/Examples/Choque De Clanes Th 15 Nueva Versin Hack.md
DELETED
@@ -1,88 +0,0 @@
|
|
1 |
-
<br />
|
2 |
-
<h1>Choque de clanes TH 15 Nueva versión Hack Descargar: Todo lo que necesita saber</h1>
|
3 |
-
<p>Clash of Clans es uno de los juegos de estrategia más populares y adictivos en dispositivos móviles. Tiene millones de jugadores en todo el mundo que construyen sus aldeas, entrenan a sus tropas y compiten en guerras épicas de clanes. El juego se actualiza constantemente con nuevas características y contenido, y la última adición es el Ayuntamiento 15 (TH 15), que trae nuevos edificios, tropas, hechizos y desafíos para el juego. </p>
|
4 |
-
<h2>choque de clanes th 15 nueva versión hack</h2><br /><p><b><b>Download</b> ->>> <a href="https://bltlly.com/2v6N1n">https://bltlly.com/2v6N1n</a></b></p><br /><br />
|
5 |
-
<p>Pero ¿qué pasa si quieres salir adelante de la competencia y disfrutar de todos los beneficios de TH 15 sin gastar demasiado tiempo y dinero en el juego? Ahí es donde entra una versión hack. Una versión hack es una versión modificada del juego que le da recursos ilimitados, gemas y otras ventajas. Algunos jugadores usan versiones hackeadas para progresar más rápido, experimentar con diferentes estrategias o simplemente divertirse. </p>
|
6 |
-
<p>Sin embargo, el uso de una versión de hackeo no está exento de riesgos. Puede enfrentar problemas legales, prohibiciones de cuentas, infecciones de malware u otros problemas. Es por eso que usted necesita ser cuidadoso e informado antes de descargar y utilizar una versión hack de Clash of Clans TH 15. En este artículo, le diremos todo lo que necesita saber sobre Clash of Clans TH 15 nueva versión hack descarga, incluyendo cómo hacerlo, cuáles son los riesgos y beneficios, y cuáles son algunos consejos y trucos para jugar el juego con eficacia. </p>
|
7 |
-
<h2>Cómo descargar una versión Hack de choque de clanes TH 15? </h2>
|
8 |
-
<p>Hay muchos sitios web y aplicaciones que afirman ofrecer versiones hack de Clash of Clans TH 15 de forma gratuita o por una tarifa. Sin embargo, no todos ellos son fiables o seguros. Algunos pueden contener virus, spyware u otro software malicioso que puede dañar su dispositivo o robar su información personal. Es posible que algunos no funcionen o que tu juego falle o falle. </p>
|
9 |
-
|
10 |
-
<ul>
|
11 |
-
<li>Hacer algunas investigaciones antes de descargar nada. Leer comentarios, valoraciones, y comentarios de otros usuarios que han intentado la versión hack. Busque testimonios positivos y pruebas de que la versión hack funciona como se anuncia. </li>
|
12 |
-
<li>Compruebe la reputación y la credibilidad de la página web o aplicación que ofrece la versión hack. Busque signos de profesionalismo, como una descripción clara y detallada de la versión de hackeo, una información de contacto, una política de privacidad y un descargo de responsabilidad. </li>
|
13 |
-
<li>Evite descargar cualquier cosa de fuentes desconocidas o sospechosas, como anuncios emergentes, correos electrónicos no deseados o enlaces aleatorios. Estos pueden ser intentos de phishing o estafas que pueden engañarle para que revele su información personal o financiera o descargue malware. </li>
|
14 |
-
<li>Utilice el software antivirus y el firewall en su dispositivo para protegerlo de amenazas potenciales. Escanee cualquier archivo que descargue antes de abrirlo. Elimina cualquier archivo que parezca sospechoso o que cause problemas. </li>
|
15 |
-
<li>Copia de seguridad de los datos originales del juego antes de instalar una versión hack. De esta manera, puedes restaurar tu juego a su estado normal si algo sale mal o si quieres volver a la versión oficial. </li>
|
16 |
-
</ul>
|
17 |
-
<p>Una vez que encuentre una fuente confiable para descargar una versión hack de Clash of Clans TH 15, siga estos pasos:</p>
|
18 |
-
<p></p>
|
19 |
-
<ol>
|
20 |
-
<li>Descargar el archivo APK (para dispositivos Android) o el archivo IPA (para dispositivos iOS) de la versión de corte de la fuente. </li>
|
21 |
-
<li>Habilitar fuentes desconocidas en la configuración del dispositivo para permitir la instalación de aplicaciones desde fuera de la tienda de aplicaciones oficial. </li>
|
22 |
-
<li>Busque el archivo descargado en su dispositivo y toque en él para instalarlo. </li>
|
23 |
-
<li>Lanzar la versión hack y disfrutar de jugar Clash of Clans TH 15 con recursos ilimitados, gemas, y otras características. </li>
|
24 |
-
</ol> <h2>¿Cuáles son los riesgos y beneficios de usar una versión Hack de choque de clanes TH 15? </h2>
|
25 |
-
|
26 |
-
<h3>Riesgos</h3>
|
27 |
-
<ul>
|
28 |
-
<li>Puede violar los términos del servicio y el acuerdo de licencia de usuario final del juego, lo que puede resultar en acciones legales, multas o demandas del desarrollador o editor del juego. </li>
|
29 |
-
<li>Usted puede ser expulsado del servidor del juego o perder su cuenta permanentemente si es detectado o reportado por otros jugadores o el sistema de seguridad del juego. </li>
|
30 |
-
<li>Puede perder su progreso, logros, recompensas o compras si desinstala la versión de hackeo o vuelve a la versión oficial. </li>
|
31 |
-
<li>Puede dañar su dispositivo o comprometer su rendimiento, seguridad o funcionalidad si descarga una versión defectuosa, dañada o maliciosa. </li>
|
32 |
-
<li>Puede arruinar la diversión, el desafío y el equilibrio del juego mediante el uso de ventajas injustas sobre otros jugadores o saltando la mecánica de juego prevista. </li>
|
33 |
-
</ul>
|
34 |
-
<h3>Beneficios</h3>
|
35 |
-
<ul>
|
36 |
-
<li>Usted puede ahorrar tiempo y dinero mediante la obtención de recursos ilimitados, gemas, y otras características sin gastar dinero real o molienda durante horas. </li>
|
37 |
-
<li>Puedes explorar nuevos aspectos del juego que de otra manera son inaccesibles, como nuevos edificios, tropas, hechizos y desafíos. </li>
|
38 |
-
<li>Puedes experimentar con diferentes estrategias, tácticas y combinaciones que pueden ayudarte a mejorar tus habilidades y conocimientos del juego. </li>
|
39 |
-
<li> Usted puede tener más diversión y satisfacción al lograr sus objetivos más rápido, más fácil y más eficiente. </li>
|
40 |
-
<li>Puedes impresionar a tus amigos, compañeros de clan u oponentes mostrando tus logros, estadísticas o diseño base. </li>
|
41 |
-
</ul>
|
42 |
-
<h2>¿Cuáles son algunos consejos y trucos para jugar choque de clanes TH 15 con eficacia? </h2>
|
43 |
-
<p>Ya sea que uses una versión hack o no, jugar Clash of Clans TH 15 puede ser desafiante y gratificante. Aquí hay algunos consejos y trucos que pueden ayudarte a jugar el juego de manera efectiva:</p>
|
44 |
-
<ul>
|
45 |
-
|
46 |
-
<li>Construir y actualizar los nuevos edificios que vienen con TH 15, tales como la casa del animal doméstico, la cabaña del constructor, la torre del infierno nivel 7, y el nivel de artillería del águila 4. Estos edificios pueden proporcionarle nuevas capacidades defensivas y ofensivas. </li>
|
47 |
-
<li>Entrena y mejora las nuevas tropas y hechizos que vienen con TH 15, como el globo cohete, el jinete del dragón, el Super Archer, y el hechizo de invisibilidad. Estas tropas y hechizos pueden darte una ventaja en las batallas. </li>
|
48 |
-
<li>Recoge y actualiza las nuevas mascotas que vienen con TH 15, como L.A.S.S.I., Electro Owl, Mighty Yak y Unicornio. Estas mascotas pueden acompañar a tus héroes y proporcionarles apoyo y habilidades adicionales. </li>
|
49 |
-
<li>Usa el nuevo Cuartel de Asedio de nivel 5 y el Taller de Asedio de nivel 5 para desplegar más tropas y máquinas de asedio en las batallas. También puedes usar la nueva máquina de asedio Log Launcher para atravesar paredes e infligir daño a edificios enemigos. </li>
|
50 |
-
<li>Únete a un clan o crea tu propio clan para participar en guerras de clanes, juegos de clanes, ligas de guerra de clanes y beneficios de clanes. También puedes chatear con otros jugadores, solicitar y donar tropas y hechizos, y compartir repeticiones y estrategias. </li>
|
51 |
-
</ul>
|
52 |
-
<h2>Conclusión</h2>
|
53 |
-
<p>Clash of Clans TH 15 es una emocionante actualización que trae nuevas características y contenido al juego. Sin embargo, si quieres disfrutar de todos los beneficios de TH 15 sin gastar demasiado tiempo y dinero en el juego, usted puede considerar la descarga de una versión hack de Clash of Clans TH 15. Una versión hack puede darle recursos ilimitados, gemas y otras ventajas que pueden ayudarle a progresar más rápido y divertirse más. Sin embargo, el uso de una versión hack también viene con riesgos, como problemas legales, prohibiciones de cuenta, infecciones de malware o problemas de juego. Por lo tanto, usted necesita ser cuidadoso e informado antes de descargar y utilizar una versión hack de Clash of Clans TH 15. También necesitas seguir algunos consejos y trucos para jugar el juego de manera efectiva y aprovechar al máximo tu experiencia de juego. </p>
|
54 |
-
|
55 |
-
<h2>Preguntas frecuentes</h2>
|
56 |
-
<p>Aquí hay algunas preguntas frecuentes relacionadas con el tema de Clash of Clans TH 15 nueva versión hack descargar:</p>
|
57 |
-
<h3>Q: ¿Es legal usar una versión hack de Clash of Clans TH 15? </h3>
|
58 |
-
<p>A: No, no es legal usar una versión hackeada de Clash of Clans TH 15. Viola los términos del servicio y el acuerdo de licencia de usuario final del juego, lo que puede resultar en acciones legales, multas o demandas del desarrollador o editor del juego. También puede ser expulsado del servidor del juego o perder su cuenta permanentemente si es detectado o reportado por otros jugadores o el sistema de seguridad del juego. </p>
|
59 |
-
<h3>Q: ¿Es seguro usar una versión hack de Clash of Clans TH 15? </h3>
|
60 |
-
<p>A: No, no es seguro usar una versión hack de Clash of Clans TH 15. Puede dañar su dispositivo o comprometer su rendimiento, seguridad o funcionalidad si descarga una versión defectuosa, dañada o maliciosa. También puede perder su progreso, logros, recompensas o compras si desinstala la versión de hackeo o vuelve a la versión oficial. También puede arruinar la diversión, el desafío y el equilibrio del juego mediante el uso de ventajas injustas sobre otros jugadores o saltando la mecánica de juego prevista. </p>
|
61 |
-
<h3>Q: ¿Cómo puedo obtener gemas gratis en Clash of Clans TH 15? </h3>
|
62 |
-
<p>A: Hay algunas formas legítimas de obtener gemas gratis en Clash of Clans TH 15 sin usar una versión hack. Algunos de ellos son:</p>
|
63 |
-
<ul>
|
64 |
-
<li>Completar logros y eventos</li>
|
65 |
-
<li>Eliminar obstáculos y cajas de gemas</li>
|
66 |
-
<li>Abriendo los regalos del clan y las recompensas del pase de temporada</li>
|
67 |
-
<li>Participar en encuestas y ofertas</li>
|
68 |
-
<li>Comprar ofertas especiales y paquetes</li>
|
69 |
-
</ul>
|
70 |
-
<h3>Q: ¿Cuál es la mejor estrategia para el choque de clanes TH 15? </h3>
|
71 |
-
|
72 |
-
<ul>
|
73 |
-
<li>Usa una mezcla equilibrada de tropas y hechizos que puedan lidiar con diferentes tipos de defensas y situaciones</li>
|
74 |
-
<li>Usa máquinas de asedio y mascotas para apoyar a tus héroes y al ejército principal</li>
|
75 |
-
<li>Utilice exploradores y repeticiones para analizar la base de su enemigo y planificar su ataque en consecuencia</li>
|
76 |
-
<li>Utiliza técnicas de canalización para guiar a tus tropas al núcleo de la base del enemigo</li>
|
77 |
-
<li>Usa hechizos sabiamente y oportunamente para mejorar las habilidades de tus tropas o contrarrestar las defensas del enemigo</li>
|
78 |
-
</ul>
|
79 |
-
<h3>Q: ¿Cómo puedo unirme a un buen clan en Clash of Clans TH 15? </h3>
|
80 |
-
<p>A: Unirse a un buen clan en Clash of Clans TH 15 puede mejorar tu experiencia de juego proporcionándote interacción social, donaciones de tropas, beneficios de clan, guerras de clan, juegos de clan y ligas de guerra de clan. Algunas maneras de encontrar y unirse a un buen clan son:</p>
|
81 |
-
<ul>
|
82 |
-
<li>Usa la función de búsqueda de clanes en el juego para filtrar clanes por nombre, ubicación, nivel, miembros, trofeos, frecuencia de guerra, victorias de guerra, liga de guerra, nivel mínimo de ayuntamiento, etc.</li>
|
83 |
-
<li>Utilice sitios web externos o aplicaciones como [Clash of Stats](https://www.clashofstats.com/), [Clash Champs](https://www.clashchamps.com/), [Clash Leaders](https:/ww.clashleaders.com/), etc. para encontrar clanes basados en diversos criterios y estadísticas. </li>
|
84 |
-
<li>Utilice plataformas de medios sociales como [Reddit](https:/www.reddit.com/r/ClashOfClans/), [Discord](https://discord.com/invite/clashofclans), [Facebook](https:/ww.facebook.com/ClashofClans/), [Twitter https:///tter.cofashans), etc. </li>
|
85 |
-
<li>Pídele a tus amigos, familiares o conocidos que jueguen a Clash of Clans que te inviten a sus clanes o te recomienden algunos buenos clanes. </li>
|
86 |
-
</ul></p> 64aa2da5cf<br />
|
87 |
-
<br />
|
88 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Benson/text-generation/Examples/Cmo Descargar Oficina 2019 Gratis.md
DELETED
@@ -1,61 +0,0 @@
|
|
1 |
-
|
2 |
-
<h1>Cómo descargar Office 2019 gratis</h1>
|
3 |
-
<p>Microsoft Office es una de las suites de productividad más populares y ampliamente utilizadas en el mundo. Incluye potentes aplicaciones como Word, Excel, PowerPoint, Outlook y más. Sin embargo, obtener la última versión de Office puede ser caro, especialmente si desea usarlo en varios dispositivos. </p>
|
4 |
-
<p>Afortunadamente, hay algunas maneras de descargar Office 2019 gratis legalmente. En este artículo, te mostraremos qué es Office 2019, por qué lo quieres y cómo obtenerlo sin pagar un centavo. </p>
|
5 |
-
<h2>cómo descargar oficina 2019 gratis</h2><br /><p><b><b>Download Zip</b> ✒ ✒ ✒ <a href="https://bltlly.com/2v6JyK">https://bltlly.com/2v6JyK</a></b></p><br /><br />
|
6 |
-
<h2>¿Qué es Office 2019 y por qué es posible que lo desee</h2>
|
7 |
-
<p>Office 2019 es la última versión de la suite de software de oficina de Microsoft. Fue lanzado en septiembre de 2018 y es una compra única que no requiere una suscripción. A diferencia de Office 365, que es un servicio basado en la nube que ofrece actualizaciones regulares y nuevas características, Office 2019 es un producto independiente que no recibirá cambios ni mejoras importantes. </p>
|
8 |
-
<p>Sin embargo, eso no significa que Office 2019 sea inferior o obsoleto. De hecho, hay algunas razones por las que podría preferir Office 2019 sobre Office 365. </p>
|
9 |
-
<h3>Oficina 2019 vs Oficina 365</h3>
|
10 |
-
<p>La principal diferencia entre Office 2019 y Office 365 es cómo se conectan a la nube. Ambas suites cuentan con acceso a OneDrive, el servicio de almacenamiento en la nube de Microsoft. Pero, Office 2019 no viene con ningún espacio de almacenamiento en OneDrive y no obtiene acceso a las versiones en línea de aplicaciones como Word, Excel y PowerPoint. Office 365, por otro lado, incluye 1 TB de almacenamiento gratuito y puede editar fácilmente todos sus archivos en línea. </p>
|
11 |
-
|
12 |
-
<p>Entonces, ¿cuál debes elegir? Depende de tus necesidades y preferencias. Si desea tener las últimas funciones y actualizaciones, acceder a sus archivos desde cualquier lugar y usar varios dispositivos, Office 365 podría ser una mejor opción para usted. Si desea ahorrar dinero a largo plazo, usar sus archivos sin conexión y no necesita aplicaciones o servicios adicionales, Office 2019 podría ser suficiente para usted. </p>
|
13 |
-
<h3>Características y beneficios de Office 2019</h3>
|
14 |
-
<p>A pesar de que Office 2019 no tiene todas las campanas y silbatos de Office 365, todavía tiene algunas características y beneficios impresionantes que pueden mejorar su productividad y creatividad. Estos son algunos de ellos:</p>
|
15 |
-
<ul>
|
16 |
-
<li><strong>Nuevas herramientas de entintado:</strong> Puede usar su pluma o dedo para dibujar, escribir, resaltar y borrar en Word, Excel, PowerPoint y Outlook. También puede convertir su tinta a formas o texto, o realizar problemas matemáticos complejos con Ink Math Assistant.</li>
|
17 |
-
<li><strong>Nuevos tipos de datos:</strong> Puede trabajar con nuevos tipos de datos en Excel, como Stocks y Geografía. Estos tipos de datos pueden extraer información de fuentes en línea y actualizarse automáticamente. </li>
|
18 |
-
<li><strong>Nuevas funciones:</strong> Puede usar nuevas funciones en Excel, como TEXTJOIN, CONCAT, IFS, SWITCH y más. Continuando con el artículo: <li><strong>Nuevos gráficos y efectos visuales:</strong> Puede crear gráficos e imágenes impresionantes en Excel y PowerPoint, como Embudo, Mapa, Cronología y modelos 3D. Estos gráficos y gráficos pueden ayudarlo a presentar sus datos de una manera más atractiva e interactiva. </li>
|
19 |
-
<li><strong>Nuevas animaciones y transiciones:</strong> Puede agregar nuevas animaciones y transiciones en PowerPoint, como Morph, Zoom y 3D. Estas animaciones y transiciones pueden ayudarle a crear presentaciones dinámicas y cautivadoras. </li>
|
20 |
-
|
21 |
-
<li><strong>Nuevas herramientas de aprendizaje:</strong> Puede usar nuevas herramientas de aprendizaje en Word y Outlook, como Leer en voz alta, Espaciado de texto y Modo de enfoque. Estas herramientas de aprendizaje pueden ayudarte a mejorar tus habilidades de lectura y escritura. </li>
|
22 |
-
</ul>
|
23 |
-
<h2>Cómo obtener Office 2019 gratis legalmente</h2>
|
24 |
-
<p>Si estás interesado en obtener Office 2019 gratis legalmente, tienes algunas opciones que considerar. Aquí están algunas de ellas:</p>
|
25 |
-
<p></p>
|
26 |
-
<h3>Opción 1: Usar Microsoft 365 para la Web</h3>
|
27 |
-
<p>Una de las maneras más fáciles de obtener Office 2019 gratis es usar Microsoft 365 para la web. Esta es una versión en línea gratuita de Office que incluye Word, Excel, PowerPoint, OneNote y Outlook. Puede acceder a estas aplicaciones desde cualquier navegador y crear, editar y compartir sus archivos en línea. También obtiene 5 GB de almacenamiento gratuito en OneDrive.</p>
|
28 |
-
<p>Para usar Microsoft 365 para la web, solo necesita una cuenta de Microsoft. Si no lo tienes, puedes crear uno gratis aquí: <a href="">https://signup.live.com/</a>. Una vez que tenga una cuenta, puede iniciar sesión aquí: <a href="">https://www.office.com/</a>. A continuación, puede comenzar a usar las aplicaciones desde la página de inicio o el lanzador de aplicaciones. </p>
|
29 |
-
<h3>Opción 2: Utilice el programa de descuento de Microsoft Workplace</h3>
|
30 |
-
<p>Otra manera de obtener Office 2019 de forma gratuita es utilizar Microsoft Workplace Discount Program. Este es un programa que permite a los empleados elegibles de las organizaciones participantes obtener Office 2019 a un precio con descuento o incluso gratis. Puede comprobar si su organización forma parte de este programa aquí: <a href="">https://www.microsoft.com/en-us/home-use-program</a>. </p>
|
31 |
-
<p>Para utilizar Microsoft Workplace Discount Program, necesita una dirección de correo electrónico de trabajo válida de su organización. Si su organización es elegible, recibirá un correo electrónico con un enlace para comprar Office 2019 a un precio reducido o gratis. A continuación, puede descargar e instalar Office 2019 en su dispositivo personal. </p>
|
32 |
-
<h3>Opción 3: Utilice el servidor en línea de Microsoft Office</h3>
|
33 |
-
|
34 |
-
<p>Para usar Microsoft Office Online Server, necesita una licencia de Windows Server y una licencia de Office. Usted puede obtener estas licencias de forma gratuita si usted es un estudiante o un educador. Puedes comprobar si eres elegible aquí: <a href="">https://www.microsoft.com/en-us/education/products/office</a>. Una vez que tenga las licencias, puede descargar e instalar Office Online Server en su servidor aquí: <a href="">https://www.microsoft.com/en-us/download/details.aspx?id=49030</a>. Luego, puede configurar y usar las aplicaciones desde su servidor. </p> Continuando con el artículo: <h2>Cómo instalar y activar Office 2019 en su PC o Mac</h2>
|
35 |
-
<p>Si ha comprado u obtenido Office 2019 a través de una de las opciones anteriores, puede instalarlo y activarlo en su PC o Mac. Estos son los pasos para hacerlo:</p>
|
36 |
-
<h3>Paso 1: Descargar Office 2019 desde una fuente de confianza</h3>
|
37 |
-
<p>El primer paso es descargar Office 2019 desde una fuente confiable. Puede hacerlo desde la Tienda de Microsoft, el sitio web de Microsoft o el enlace que recibió de su organización o escuela. Asegúrese de descargar la versión correcta para su dispositivo y sistema operativo. </p>
|
38 |
-
<h3>Paso 2: Ejecute el archivo de configuración y siga las instrucciones</h3>
|
39 |
-
<p>El segundo paso es ejecutar el archivo de configuración y seguir las instrucciones. Dependiendo de su dispositivo y sistema operativo, el archivo de configuración podría ser un . exe, . dmg, o archivo . iso. Haga doble clic en el archivo y permita que se ejecute. Luego, siga las instrucciones en la pantalla para instalar Office 2019 en su dispositivo. </p>
|
40 |
-
<h3>Paso 3: Ingrese su clave de producto o inicie sesión con su cuenta de Microsoft</h3>
|
41 |
-
|
42 |
-
<p>Para activar Office 2019, debe ingresar su clave de producto o iniciar sesión con su cuenta de Microsoft. Puede hacer esto cuando inicie cualquiera de las aplicaciones de Office por primera vez. Verá una solicitud para activar Office 2019. Siga las instrucciones en la pantalla para introducir su clave de producto o iniciar sesión con su cuenta de Microsoft. </p>
|
43 |
-
<h2>Conclusión</h2>
|
44 |
-
<p>Office 2019 es una suite de productividad potente y versátil que puede ayudarlo a crear, editar y compartir documentos, hojas de cálculo, presentaciones y más. Sin embargo, también puede ser caro, especialmente si desea usarlo en varios dispositivos. </p>
|
45 |
-
<p>En este artículo, le hemos mostrado cómo descargar Office 2019 gratis legalmente. Puede utilizar Microsoft 365 para la web, Microsoft Workplace Discount Program o Microsoft Office Online Server. También puede instalar y activar Office 2019 en su PC o Mac siguiendo algunos pasos simples. </p>
|
46 |
-
<p>Esperamos que este artículo haya sido útil e informativo para usted. Si tiene alguna pregunta o comentario, no dude en dejar un comentario a continuación. </p>
|
47 |
-
<h2>Preguntas frecuentes</h2>
|
48 |
-
<ul>
|
49 |
-
<li><strong>Q: ¿Es Office 2019 compatible con Windows 10? </strong></li>
|
50 |
-
<li>A: Sí, Office 2019 es compatible con Windows 10. También es compatible con Windows 8.1 y Windows Server 2019. </li>
|
51 |
-
<li><strong>Q: ¿Es Office 2019 compatible con Mac OS? </strong></li>
|
52 |
-
<li>A: Sí, Office 2019 es compatible con Mac OS. También es compatible con Mac OS X 10.14 Mojave y versiones posteriores. </li>
|
53 |
-
<li><strong>Q: ¿Cuántos dispositivos puedo instalar Office 2019 en? </strong></li>
|
54 |
-
<li>A: Puede instalar Office 2019 en un dispositivo por licencia. Si desea usarlo en varios dispositivos, debe comprar varias licencias o usar Office 365 en su lugar. </li>
|
55 |
-
<li><strong>Q: ¿Cuánto tiempo dura Office 2019? </strong></li>
|
56 |
-
<li>A: Office 2019 dura tanto como su dispositivo lo soporte. No caduca ni requiere renovación. Sin embargo, no recibe ninguna actualización importante o nuevas características. </li>
|
57 |
-
|
58 |
-
<li>A: Sí, puede actualizar de Office 2016 a Office 2019. Sin embargo, necesita comprar una nueva licencia para Office 2019 o usar una de las opciones anteriores para obtenerla de forma gratuita. </li>
|
59 |
-
</ul></p> 64aa2da5cf<br />
|
60 |
-
<br />
|
61 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Big-Web/MMSD/env/Lib/site-packages/botocore/retries/__init__.py
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
"""New retry v2 handlers.
|
2 |
-
|
3 |
-
This package obsoletes the botocore/retryhandler.py module and contains
|
4 |
-
new retry logic.
|
5 |
-
|
6 |
-
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Big-Web/MMSD/env/Lib/site-packages/pip/_vendor/colorama/initialise.py
DELETED
@@ -1,121 +0,0 @@
|
|
1 |
-
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
|
2 |
-
import atexit
|
3 |
-
import contextlib
|
4 |
-
import sys
|
5 |
-
|
6 |
-
from .ansitowin32 import AnsiToWin32
|
7 |
-
|
8 |
-
|
9 |
-
def _wipe_internal_state_for_tests():
|
10 |
-
global orig_stdout, orig_stderr
|
11 |
-
orig_stdout = None
|
12 |
-
orig_stderr = None
|
13 |
-
|
14 |
-
global wrapped_stdout, wrapped_stderr
|
15 |
-
wrapped_stdout = None
|
16 |
-
wrapped_stderr = None
|
17 |
-
|
18 |
-
global atexit_done
|
19 |
-
atexit_done = False
|
20 |
-
|
21 |
-
global fixed_windows_console
|
22 |
-
fixed_windows_console = False
|
23 |
-
|
24 |
-
try:
|
25 |
-
# no-op if it wasn't registered
|
26 |
-
atexit.unregister(reset_all)
|
27 |
-
except AttributeError:
|
28 |
-
# python 2: no atexit.unregister. Oh well, we did our best.
|
29 |
-
pass
|
30 |
-
|
31 |
-
|
32 |
-
def reset_all():
|
33 |
-
if AnsiToWin32 is not None: # Issue #74: objects might become None at exit
|
34 |
-
AnsiToWin32(orig_stdout).reset_all()
|
35 |
-
|
36 |
-
|
37 |
-
def init(autoreset=False, convert=None, strip=None, wrap=True):
|
38 |
-
|
39 |
-
if not wrap and any([autoreset, convert, strip]):
|
40 |
-
raise ValueError('wrap=False conflicts with any other arg=True')
|
41 |
-
|
42 |
-
global wrapped_stdout, wrapped_stderr
|
43 |
-
global orig_stdout, orig_stderr
|
44 |
-
|
45 |
-
orig_stdout = sys.stdout
|
46 |
-
orig_stderr = sys.stderr
|
47 |
-
|
48 |
-
if sys.stdout is None:
|
49 |
-
wrapped_stdout = None
|
50 |
-
else:
|
51 |
-
sys.stdout = wrapped_stdout = \
|
52 |
-
wrap_stream(orig_stdout, convert, strip, autoreset, wrap)
|
53 |
-
if sys.stderr is None:
|
54 |
-
wrapped_stderr = None
|
55 |
-
else:
|
56 |
-
sys.stderr = wrapped_stderr = \
|
57 |
-
wrap_stream(orig_stderr, convert, strip, autoreset, wrap)
|
58 |
-
|
59 |
-
global atexit_done
|
60 |
-
if not atexit_done:
|
61 |
-
atexit.register(reset_all)
|
62 |
-
atexit_done = True
|
63 |
-
|
64 |
-
|
65 |
-
def deinit():
|
66 |
-
if orig_stdout is not None:
|
67 |
-
sys.stdout = orig_stdout
|
68 |
-
if orig_stderr is not None:
|
69 |
-
sys.stderr = orig_stderr
|
70 |
-
|
71 |
-
|
72 |
-
def just_fix_windows_console():
|
73 |
-
global fixed_windows_console
|
74 |
-
|
75 |
-
if sys.platform != "win32":
|
76 |
-
return
|
77 |
-
if fixed_windows_console:
|
78 |
-
return
|
79 |
-
if wrapped_stdout is not None or wrapped_stderr is not None:
|
80 |
-
# Someone already ran init() and it did stuff, so we won't second-guess them
|
81 |
-
return
|
82 |
-
|
83 |
-
# On newer versions of Windows, AnsiToWin32.__init__ will implicitly enable the
|
84 |
-
# native ANSI support in the console as a side-effect. We only need to actually
|
85 |
-
# replace sys.stdout/stderr if we're in the old-style conversion mode.
|
86 |
-
new_stdout = AnsiToWin32(sys.stdout, convert=None, strip=None, autoreset=False)
|
87 |
-
if new_stdout.convert:
|
88 |
-
sys.stdout = new_stdout
|
89 |
-
new_stderr = AnsiToWin32(sys.stderr, convert=None, strip=None, autoreset=False)
|
90 |
-
if new_stderr.convert:
|
91 |
-
sys.stderr = new_stderr
|
92 |
-
|
93 |
-
fixed_windows_console = True
|
94 |
-
|
95 |
-
@contextlib.contextmanager
|
96 |
-
def colorama_text(*args, **kwargs):
|
97 |
-
init(*args, **kwargs)
|
98 |
-
try:
|
99 |
-
yield
|
100 |
-
finally:
|
101 |
-
deinit()
|
102 |
-
|
103 |
-
|
104 |
-
def reinit():
|
105 |
-
if wrapped_stdout is not None:
|
106 |
-
sys.stdout = wrapped_stdout
|
107 |
-
if wrapped_stderr is not None:
|
108 |
-
sys.stderr = wrapped_stderr
|
109 |
-
|
110 |
-
|
111 |
-
def wrap_stream(stream, convert, strip, autoreset, wrap):
|
112 |
-
if wrap:
|
113 |
-
wrapper = AnsiToWin32(stream,
|
114 |
-
convert=convert, strip=strip, autoreset=autoreset)
|
115 |
-
if wrapper.should_wrap():
|
116 |
-
stream = wrapper.stream
|
117 |
-
return stream
|
118 |
-
|
119 |
-
|
120 |
-
# Use this for initial setup as well, to reduce code duplication
|
121 |
-
_wipe_internal_state_for_tests()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Big-Web/MMSD/env/Lib/site-packages/s3transfer/crt.py
DELETED
@@ -1,644 +0,0 @@
|
|
1 |
-
# Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
2 |
-
#
|
3 |
-
# Licensed under the Apache License, Version 2.0 (the "License"). You
|
4 |
-
# may not use this file except in compliance with the License. A copy of
|
5 |
-
# the License is located at
|
6 |
-
#
|
7 |
-
# http://aws.amazon.com/apache2.0/
|
8 |
-
#
|
9 |
-
# or in the "license" file accompanying this file. This file is
|
10 |
-
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
11 |
-
# ANY KIND, either express or implied. See the License for the specific
|
12 |
-
# language governing permissions and limitations under the License.
|
13 |
-
import logging
|
14 |
-
import threading
|
15 |
-
from io import BytesIO
|
16 |
-
|
17 |
-
import awscrt.http
|
18 |
-
import botocore.awsrequest
|
19 |
-
import botocore.session
|
20 |
-
from awscrt.auth import AwsCredentials, AwsCredentialsProvider
|
21 |
-
from awscrt.io import (
|
22 |
-
ClientBootstrap,
|
23 |
-
ClientTlsContext,
|
24 |
-
DefaultHostResolver,
|
25 |
-
EventLoopGroup,
|
26 |
-
TlsContextOptions,
|
27 |
-
)
|
28 |
-
from awscrt.s3 import S3Client, S3RequestTlsMode, S3RequestType
|
29 |
-
from botocore import UNSIGNED
|
30 |
-
from botocore.compat import urlsplit
|
31 |
-
from botocore.config import Config
|
32 |
-
from botocore.exceptions import NoCredentialsError
|
33 |
-
|
34 |
-
from s3transfer.constants import GB, MB
|
35 |
-
from s3transfer.exceptions import TransferNotDoneError
|
36 |
-
from s3transfer.futures import BaseTransferFuture, BaseTransferMeta
|
37 |
-
from s3transfer.utils import CallArgs, OSUtils, get_callbacks
|
38 |
-
|
39 |
-
logger = logging.getLogger(__name__)
|
40 |
-
|
41 |
-
|
42 |
-
class CRTCredentialProviderAdapter:
|
43 |
-
def __init__(self, botocore_credential_provider):
|
44 |
-
self._botocore_credential_provider = botocore_credential_provider
|
45 |
-
self._loaded_credentials = None
|
46 |
-
self._lock = threading.Lock()
|
47 |
-
|
48 |
-
def __call__(self):
|
49 |
-
credentials = self._get_credentials().get_frozen_credentials()
|
50 |
-
return AwsCredentials(
|
51 |
-
credentials.access_key, credentials.secret_key, credentials.token
|
52 |
-
)
|
53 |
-
|
54 |
-
def _get_credentials(self):
|
55 |
-
with self._lock:
|
56 |
-
if self._loaded_credentials is None:
|
57 |
-
loaded_creds = (
|
58 |
-
self._botocore_credential_provider.load_credentials()
|
59 |
-
)
|
60 |
-
if loaded_creds is None:
|
61 |
-
raise NoCredentialsError()
|
62 |
-
self._loaded_credentials = loaded_creds
|
63 |
-
return self._loaded_credentials
|
64 |
-
|
65 |
-
|
66 |
-
def create_s3_crt_client(
|
67 |
-
region,
|
68 |
-
botocore_credential_provider=None,
|
69 |
-
num_threads=None,
|
70 |
-
target_throughput=5 * GB / 8,
|
71 |
-
part_size=8 * MB,
|
72 |
-
use_ssl=True,
|
73 |
-
verify=None,
|
74 |
-
):
|
75 |
-
"""
|
76 |
-
:type region: str
|
77 |
-
:param region: The region used for signing
|
78 |
-
|
79 |
-
:type botocore_credential_provider:
|
80 |
-
Optional[botocore.credentials.CredentialResolver]
|
81 |
-
:param botocore_credential_provider: Provide credentials for CRT
|
82 |
-
to sign the request if not set, the request will not be signed
|
83 |
-
|
84 |
-
:type num_threads: Optional[int]
|
85 |
-
:param num_threads: Number of worker threads generated. Default
|
86 |
-
is the number of processors in the machine.
|
87 |
-
|
88 |
-
:type target_throughput: Optional[int]
|
89 |
-
:param target_throughput: Throughput target in Bytes.
|
90 |
-
Default is 0.625 GB/s (which translates to 5 Gb/s).
|
91 |
-
|
92 |
-
:type part_size: Optional[int]
|
93 |
-
:param part_size: Size, in Bytes, of parts that files will be downloaded
|
94 |
-
or uploaded in.
|
95 |
-
|
96 |
-
:type use_ssl: boolean
|
97 |
-
:param use_ssl: Whether or not to use SSL. By default, SSL is used.
|
98 |
-
Note that not all services support non-ssl connections.
|
99 |
-
|
100 |
-
:type verify: Optional[boolean/string]
|
101 |
-
:param verify: Whether or not to verify SSL certificates.
|
102 |
-
By default SSL certificates are verified. You can provide the
|
103 |
-
following values:
|
104 |
-
|
105 |
-
* False - do not validate SSL certificates. SSL will still be
|
106 |
-
used (unless use_ssl is False), but SSL certificates
|
107 |
-
will not be verified.
|
108 |
-
* path/to/cert/bundle.pem - A filename of the CA cert bundle to
|
109 |
-
use. Specify this argument if you want to use a custom CA cert
|
110 |
-
bundle instead of the default one on your system.
|
111 |
-
"""
|
112 |
-
|
113 |
-
event_loop_group = EventLoopGroup(num_threads)
|
114 |
-
host_resolver = DefaultHostResolver(event_loop_group)
|
115 |
-
bootstrap = ClientBootstrap(event_loop_group, host_resolver)
|
116 |
-
provider = None
|
117 |
-
tls_connection_options = None
|
118 |
-
|
119 |
-
tls_mode = (
|
120 |
-
S3RequestTlsMode.ENABLED if use_ssl else S3RequestTlsMode.DISABLED
|
121 |
-
)
|
122 |
-
if verify is not None:
|
123 |
-
tls_ctx_options = TlsContextOptions()
|
124 |
-
if verify:
|
125 |
-
tls_ctx_options.override_default_trust_store_from_path(
|
126 |
-
ca_filepath=verify
|
127 |
-
)
|
128 |
-
else:
|
129 |
-
tls_ctx_options.verify_peer = False
|
130 |
-
client_tls_option = ClientTlsContext(tls_ctx_options)
|
131 |
-
tls_connection_options = client_tls_option.new_connection_options()
|
132 |
-
if botocore_credential_provider:
|
133 |
-
credentails_provider_adapter = CRTCredentialProviderAdapter(
|
134 |
-
botocore_credential_provider
|
135 |
-
)
|
136 |
-
provider = AwsCredentialsProvider.new_delegate(
|
137 |
-
credentails_provider_adapter
|
138 |
-
)
|
139 |
-
|
140 |
-
target_gbps = target_throughput * 8 / GB
|
141 |
-
return S3Client(
|
142 |
-
bootstrap=bootstrap,
|
143 |
-
region=region,
|
144 |
-
credential_provider=provider,
|
145 |
-
part_size=part_size,
|
146 |
-
tls_mode=tls_mode,
|
147 |
-
tls_connection_options=tls_connection_options,
|
148 |
-
throughput_target_gbps=target_gbps,
|
149 |
-
)
|
150 |
-
|
151 |
-
|
152 |
-
class CRTTransferManager:
|
153 |
-
def __init__(self, crt_s3_client, crt_request_serializer, osutil=None):
|
154 |
-
"""A transfer manager interface for Amazon S3 on CRT s3 client.
|
155 |
-
|
156 |
-
:type crt_s3_client: awscrt.s3.S3Client
|
157 |
-
:param crt_s3_client: The CRT s3 client, handling all the
|
158 |
-
HTTP requests and functions under then hood
|
159 |
-
|
160 |
-
:type crt_request_serializer: s3transfer.crt.BaseCRTRequestSerializer
|
161 |
-
:param crt_request_serializer: Serializer, generates unsigned crt HTTP
|
162 |
-
request.
|
163 |
-
|
164 |
-
:type osutil: s3transfer.utils.OSUtils
|
165 |
-
:param osutil: OSUtils object to use for os-related behavior when
|
166 |
-
using with transfer manager.
|
167 |
-
"""
|
168 |
-
if osutil is None:
|
169 |
-
self._osutil = OSUtils()
|
170 |
-
self._crt_s3_client = crt_s3_client
|
171 |
-
self._s3_args_creator = S3ClientArgsCreator(
|
172 |
-
crt_request_serializer, self._osutil
|
173 |
-
)
|
174 |
-
self._future_coordinators = []
|
175 |
-
self._semaphore = threading.Semaphore(128) # not configurable
|
176 |
-
# A counter to create unique id's for each transfer submitted.
|
177 |
-
self._id_counter = 0
|
178 |
-
|
179 |
-
def __enter__(self):
|
180 |
-
return self
|
181 |
-
|
182 |
-
def __exit__(self, exc_type, exc_value, *args):
|
183 |
-
cancel = False
|
184 |
-
if exc_type:
|
185 |
-
cancel = True
|
186 |
-
self._shutdown(cancel)
|
187 |
-
|
188 |
-
def download(
|
189 |
-
self, bucket, key, fileobj, extra_args=None, subscribers=None
|
190 |
-
):
|
191 |
-
if extra_args is None:
|
192 |
-
extra_args = {}
|
193 |
-
if subscribers is None:
|
194 |
-
subscribers = {}
|
195 |
-
callargs = CallArgs(
|
196 |
-
bucket=bucket,
|
197 |
-
key=key,
|
198 |
-
fileobj=fileobj,
|
199 |
-
extra_args=extra_args,
|
200 |
-
subscribers=subscribers,
|
201 |
-
)
|
202 |
-
return self._submit_transfer("get_object", callargs)
|
203 |
-
|
204 |
-
def upload(self, fileobj, bucket, key, extra_args=None, subscribers=None):
|
205 |
-
if extra_args is None:
|
206 |
-
extra_args = {}
|
207 |
-
if subscribers is None:
|
208 |
-
subscribers = {}
|
209 |
-
callargs = CallArgs(
|
210 |
-
bucket=bucket,
|
211 |
-
key=key,
|
212 |
-
fileobj=fileobj,
|
213 |
-
extra_args=extra_args,
|
214 |
-
subscribers=subscribers,
|
215 |
-
)
|
216 |
-
return self._submit_transfer("put_object", callargs)
|
217 |
-
|
218 |
-
def delete(self, bucket, key, extra_args=None, subscribers=None):
|
219 |
-
if extra_args is None:
|
220 |
-
extra_args = {}
|
221 |
-
if subscribers is None:
|
222 |
-
subscribers = {}
|
223 |
-
callargs = CallArgs(
|
224 |
-
bucket=bucket,
|
225 |
-
key=key,
|
226 |
-
extra_args=extra_args,
|
227 |
-
subscribers=subscribers,
|
228 |
-
)
|
229 |
-
return self._submit_transfer("delete_object", callargs)
|
230 |
-
|
231 |
-
def shutdown(self, cancel=False):
|
232 |
-
self._shutdown(cancel)
|
233 |
-
|
234 |
-
def _cancel_transfers(self):
|
235 |
-
for coordinator in self._future_coordinators:
|
236 |
-
if not coordinator.done():
|
237 |
-
coordinator.cancel()
|
238 |
-
|
239 |
-
def _finish_transfers(self):
|
240 |
-
for coordinator in self._future_coordinators:
|
241 |
-
coordinator.result()
|
242 |
-
|
243 |
-
def _wait_transfers_done(self):
|
244 |
-
for coordinator in self._future_coordinators:
|
245 |
-
coordinator.wait_until_on_done_callbacks_complete()
|
246 |
-
|
247 |
-
def _shutdown(self, cancel=False):
|
248 |
-
if cancel:
|
249 |
-
self._cancel_transfers()
|
250 |
-
try:
|
251 |
-
self._finish_transfers()
|
252 |
-
|
253 |
-
except KeyboardInterrupt:
|
254 |
-
self._cancel_transfers()
|
255 |
-
except Exception:
|
256 |
-
pass
|
257 |
-
finally:
|
258 |
-
self._wait_transfers_done()
|
259 |
-
|
260 |
-
def _release_semaphore(self, **kwargs):
|
261 |
-
self._semaphore.release()
|
262 |
-
|
263 |
-
def _submit_transfer(self, request_type, call_args):
|
264 |
-
on_done_after_calls = [self._release_semaphore]
|
265 |
-
coordinator = CRTTransferCoordinator(transfer_id=self._id_counter)
|
266 |
-
components = {
|
267 |
-
'meta': CRTTransferMeta(self._id_counter, call_args),
|
268 |
-
'coordinator': coordinator,
|
269 |
-
}
|
270 |
-
future = CRTTransferFuture(**components)
|
271 |
-
afterdone = AfterDoneHandler(coordinator)
|
272 |
-
on_done_after_calls.append(afterdone)
|
273 |
-
|
274 |
-
try:
|
275 |
-
self._semaphore.acquire()
|
276 |
-
on_queued = self._s3_args_creator.get_crt_callback(
|
277 |
-
future, 'queued'
|
278 |
-
)
|
279 |
-
on_queued()
|
280 |
-
crt_callargs = self._s3_args_creator.get_make_request_args(
|
281 |
-
request_type,
|
282 |
-
call_args,
|
283 |
-
coordinator,
|
284 |
-
future,
|
285 |
-
on_done_after_calls,
|
286 |
-
)
|
287 |
-
crt_s3_request = self._crt_s3_client.make_request(**crt_callargs)
|
288 |
-
except Exception as e:
|
289 |
-
coordinator.set_exception(e, True)
|
290 |
-
on_done = self._s3_args_creator.get_crt_callback(
|
291 |
-
future, 'done', after_subscribers=on_done_after_calls
|
292 |
-
)
|
293 |
-
on_done(error=e)
|
294 |
-
else:
|
295 |
-
coordinator.set_s3_request(crt_s3_request)
|
296 |
-
self._future_coordinators.append(coordinator)
|
297 |
-
|
298 |
-
self._id_counter += 1
|
299 |
-
return future
|
300 |
-
|
301 |
-
|
302 |
-
class CRTTransferMeta(BaseTransferMeta):
|
303 |
-
"""Holds metadata about the CRTTransferFuture"""
|
304 |
-
|
305 |
-
def __init__(self, transfer_id=None, call_args=None):
|
306 |
-
self._transfer_id = transfer_id
|
307 |
-
self._call_args = call_args
|
308 |
-
self._user_context = {}
|
309 |
-
|
310 |
-
@property
|
311 |
-
def call_args(self):
|
312 |
-
return self._call_args
|
313 |
-
|
314 |
-
@property
|
315 |
-
def transfer_id(self):
|
316 |
-
return self._transfer_id
|
317 |
-
|
318 |
-
@property
|
319 |
-
def user_context(self):
|
320 |
-
return self._user_context
|
321 |
-
|
322 |
-
|
323 |
-
class CRTTransferFuture(BaseTransferFuture):
|
324 |
-
def __init__(self, meta=None, coordinator=None):
|
325 |
-
"""The future associated to a submitted transfer request via CRT S3 client
|
326 |
-
|
327 |
-
:type meta: s3transfer.crt.CRTTransferMeta
|
328 |
-
:param meta: The metadata associated to the transfer future.
|
329 |
-
|
330 |
-
:type coordinator: s3transfer.crt.CRTTransferCoordinator
|
331 |
-
:param coordinator: The coordinator associated to the transfer future.
|
332 |
-
"""
|
333 |
-
self._meta = meta
|
334 |
-
if meta is None:
|
335 |
-
self._meta = CRTTransferMeta()
|
336 |
-
self._coordinator = coordinator
|
337 |
-
|
338 |
-
@property
|
339 |
-
def meta(self):
|
340 |
-
return self._meta
|
341 |
-
|
342 |
-
def done(self):
|
343 |
-
return self._coordinator.done()
|
344 |
-
|
345 |
-
def result(self, timeout=None):
|
346 |
-
self._coordinator.result(timeout)
|
347 |
-
|
348 |
-
def cancel(self):
|
349 |
-
self._coordinator.cancel()
|
350 |
-
|
351 |
-
def set_exception(self, exception):
|
352 |
-
"""Sets the exception on the future."""
|
353 |
-
if not self.done():
|
354 |
-
raise TransferNotDoneError(
|
355 |
-
'set_exception can only be called once the transfer is '
|
356 |
-
'complete.'
|
357 |
-
)
|
358 |
-
self._coordinator.set_exception(exception, override=True)
|
359 |
-
|
360 |
-
|
361 |
-
class BaseCRTRequestSerializer:
|
362 |
-
def serialize_http_request(self, transfer_type, future):
|
363 |
-
"""Serialize CRT HTTP requests.
|
364 |
-
|
365 |
-
:type transfer_type: string
|
366 |
-
:param transfer_type: the type of transfer made,
|
367 |
-
e.g 'put_object', 'get_object', 'delete_object'
|
368 |
-
|
369 |
-
:type future: s3transfer.crt.CRTTransferFuture
|
370 |
-
|
371 |
-
:rtype: awscrt.http.HttpRequest
|
372 |
-
:returns: An unsigned HTTP request to be used for the CRT S3 client
|
373 |
-
"""
|
374 |
-
raise NotImplementedError('serialize_http_request()')
|
375 |
-
|
376 |
-
|
377 |
-
class BotocoreCRTRequestSerializer(BaseCRTRequestSerializer):
|
378 |
-
def __init__(self, session, client_kwargs=None):
|
379 |
-
"""Serialize CRT HTTP request using botocore logic
|
380 |
-
It also takes into account configuration from both the session
|
381 |
-
and any keyword arguments that could be passed to
|
382 |
-
`Session.create_client()` when serializing the request.
|
383 |
-
|
384 |
-
:type session: botocore.session.Session
|
385 |
-
|
386 |
-
:type client_kwargs: Optional[Dict[str, str]])
|
387 |
-
:param client_kwargs: The kwargs for the botocore
|
388 |
-
s3 client initialization.
|
389 |
-
"""
|
390 |
-
self._session = session
|
391 |
-
if client_kwargs is None:
|
392 |
-
client_kwargs = {}
|
393 |
-
self._resolve_client_config(session, client_kwargs)
|
394 |
-
self._client = session.create_client(**client_kwargs)
|
395 |
-
self._client.meta.events.register(
|
396 |
-
'request-created.s3.*', self._capture_http_request
|
397 |
-
)
|
398 |
-
self._client.meta.events.register(
|
399 |
-
'after-call.s3.*', self._change_response_to_serialized_http_request
|
400 |
-
)
|
401 |
-
self._client.meta.events.register(
|
402 |
-
'before-send.s3.*', self._make_fake_http_response
|
403 |
-
)
|
404 |
-
|
405 |
-
def _resolve_client_config(self, session, client_kwargs):
|
406 |
-
user_provided_config = None
|
407 |
-
if session.get_default_client_config():
|
408 |
-
user_provided_config = session.get_default_client_config()
|
409 |
-
if 'config' in client_kwargs:
|
410 |
-
user_provided_config = client_kwargs['config']
|
411 |
-
|
412 |
-
client_config = Config(signature_version=UNSIGNED)
|
413 |
-
if user_provided_config:
|
414 |
-
client_config = user_provided_config.merge(client_config)
|
415 |
-
client_kwargs['config'] = client_config
|
416 |
-
client_kwargs["service_name"] = "s3"
|
417 |
-
|
418 |
-
def _crt_request_from_aws_request(self, aws_request):
|
419 |
-
url_parts = urlsplit(aws_request.url)
|
420 |
-
crt_path = url_parts.path
|
421 |
-
if url_parts.query:
|
422 |
-
crt_path = f'{crt_path}?{url_parts.query}'
|
423 |
-
headers_list = []
|
424 |
-
for name, value in aws_request.headers.items():
|
425 |
-
if isinstance(value, str):
|
426 |
-
headers_list.append((name, value))
|
427 |
-
else:
|
428 |
-
headers_list.append((name, str(value, 'utf-8')))
|
429 |
-
|
430 |
-
crt_headers = awscrt.http.HttpHeaders(headers_list)
|
431 |
-
# CRT requires body (if it exists) to be an I/O stream.
|
432 |
-
crt_body_stream = None
|
433 |
-
if aws_request.body:
|
434 |
-
if hasattr(aws_request.body, 'seek'):
|
435 |
-
crt_body_stream = aws_request.body
|
436 |
-
else:
|
437 |
-
crt_body_stream = BytesIO(aws_request.body)
|
438 |
-
|
439 |
-
crt_request = awscrt.http.HttpRequest(
|
440 |
-
method=aws_request.method,
|
441 |
-
path=crt_path,
|
442 |
-
headers=crt_headers,
|
443 |
-
body_stream=crt_body_stream,
|
444 |
-
)
|
445 |
-
return crt_request
|
446 |
-
|
447 |
-
def _convert_to_crt_http_request(self, botocore_http_request):
|
448 |
-
# Logic that does CRTUtils.crt_request_from_aws_request
|
449 |
-
crt_request = self._crt_request_from_aws_request(botocore_http_request)
|
450 |
-
if crt_request.headers.get("host") is None:
|
451 |
-
# If host is not set, set it for the request before using CRT s3
|
452 |
-
url_parts = urlsplit(botocore_http_request.url)
|
453 |
-
crt_request.headers.set("host", url_parts.netloc)
|
454 |
-
if crt_request.headers.get('Content-MD5') is not None:
|
455 |
-
crt_request.headers.remove("Content-MD5")
|
456 |
-
return crt_request
|
457 |
-
|
458 |
-
def _capture_http_request(self, request, **kwargs):
|
459 |
-
request.context['http_request'] = request
|
460 |
-
|
461 |
-
def _change_response_to_serialized_http_request(
|
462 |
-
self, context, parsed, **kwargs
|
463 |
-
):
|
464 |
-
request = context['http_request']
|
465 |
-
parsed['HTTPRequest'] = request.prepare()
|
466 |
-
|
467 |
-
def _make_fake_http_response(self, request, **kwargs):
|
468 |
-
return botocore.awsrequest.AWSResponse(
|
469 |
-
None,
|
470 |
-
200,
|
471 |
-
{},
|
472 |
-
FakeRawResponse(b""),
|
473 |
-
)
|
474 |
-
|
475 |
-
def _get_botocore_http_request(self, client_method, call_args):
|
476 |
-
return getattr(self._client, client_method)(
|
477 |
-
Bucket=call_args.bucket, Key=call_args.key, **call_args.extra_args
|
478 |
-
)['HTTPRequest']
|
479 |
-
|
480 |
-
def serialize_http_request(self, transfer_type, future):
|
481 |
-
botocore_http_request = self._get_botocore_http_request(
|
482 |
-
transfer_type, future.meta.call_args
|
483 |
-
)
|
484 |
-
crt_request = self._convert_to_crt_http_request(botocore_http_request)
|
485 |
-
return crt_request
|
486 |
-
|
487 |
-
|
488 |
-
class FakeRawResponse(BytesIO):
|
489 |
-
def stream(self, amt=1024, decode_content=None):
|
490 |
-
while True:
|
491 |
-
chunk = self.read(amt)
|
492 |
-
if not chunk:
|
493 |
-
break
|
494 |
-
yield chunk
|
495 |
-
|
496 |
-
|
497 |
-
class CRTTransferCoordinator:
|
498 |
-
"""A helper class for managing CRTTransferFuture"""
|
499 |
-
|
500 |
-
def __init__(self, transfer_id=None, s3_request=None):
|
501 |
-
self.transfer_id = transfer_id
|
502 |
-
self._s3_request = s3_request
|
503 |
-
self._lock = threading.Lock()
|
504 |
-
self._exception = None
|
505 |
-
self._crt_future = None
|
506 |
-
self._done_event = threading.Event()
|
507 |
-
|
508 |
-
@property
|
509 |
-
def s3_request(self):
|
510 |
-
return self._s3_request
|
511 |
-
|
512 |
-
def set_done_callbacks_complete(self):
|
513 |
-
self._done_event.set()
|
514 |
-
|
515 |
-
def wait_until_on_done_callbacks_complete(self, timeout=None):
|
516 |
-
self._done_event.wait(timeout)
|
517 |
-
|
518 |
-
def set_exception(self, exception, override=False):
|
519 |
-
with self._lock:
|
520 |
-
if not self.done() or override:
|
521 |
-
self._exception = exception
|
522 |
-
|
523 |
-
def cancel(self):
|
524 |
-
if self._s3_request:
|
525 |
-
self._s3_request.cancel()
|
526 |
-
|
527 |
-
def result(self, timeout=None):
|
528 |
-
if self._exception:
|
529 |
-
raise self._exception
|
530 |
-
try:
|
531 |
-
self._crt_future.result(timeout)
|
532 |
-
except KeyboardInterrupt:
|
533 |
-
self.cancel()
|
534 |
-
raise
|
535 |
-
finally:
|
536 |
-
if self._s3_request:
|
537 |
-
self._s3_request = None
|
538 |
-
self._crt_future.result(timeout)
|
539 |
-
|
540 |
-
def done(self):
|
541 |
-
if self._crt_future is None:
|
542 |
-
return False
|
543 |
-
return self._crt_future.done()
|
544 |
-
|
545 |
-
def set_s3_request(self, s3_request):
|
546 |
-
self._s3_request = s3_request
|
547 |
-
self._crt_future = self._s3_request.finished_future
|
548 |
-
|
549 |
-
|
550 |
-
class S3ClientArgsCreator:
|
551 |
-
def __init__(self, crt_request_serializer, os_utils):
|
552 |
-
self._request_serializer = crt_request_serializer
|
553 |
-
self._os_utils = os_utils
|
554 |
-
|
555 |
-
def get_make_request_args(
|
556 |
-
self, request_type, call_args, coordinator, future, on_done_after_calls
|
557 |
-
):
|
558 |
-
recv_filepath = None
|
559 |
-
send_filepath = None
|
560 |
-
s3_meta_request_type = getattr(
|
561 |
-
S3RequestType, request_type.upper(), S3RequestType.DEFAULT
|
562 |
-
)
|
563 |
-
on_done_before_calls = []
|
564 |
-
if s3_meta_request_type == S3RequestType.GET_OBJECT:
|
565 |
-
final_filepath = call_args.fileobj
|
566 |
-
recv_filepath = self._os_utils.get_temp_filename(final_filepath)
|
567 |
-
file_ondone_call = RenameTempFileHandler(
|
568 |
-
coordinator, final_filepath, recv_filepath, self._os_utils
|
569 |
-
)
|
570 |
-
on_done_before_calls.append(file_ondone_call)
|
571 |
-
elif s3_meta_request_type == S3RequestType.PUT_OBJECT:
|
572 |
-
send_filepath = call_args.fileobj
|
573 |
-
data_len = self._os_utils.get_file_size(send_filepath)
|
574 |
-
call_args.extra_args["ContentLength"] = data_len
|
575 |
-
|
576 |
-
crt_request = self._request_serializer.serialize_http_request(
|
577 |
-
request_type, future
|
578 |
-
)
|
579 |
-
|
580 |
-
return {
|
581 |
-
'request': crt_request,
|
582 |
-
'type': s3_meta_request_type,
|
583 |
-
'recv_filepath': recv_filepath,
|
584 |
-
'send_filepath': send_filepath,
|
585 |
-
'on_done': self.get_crt_callback(
|
586 |
-
future, 'done', on_done_before_calls, on_done_after_calls
|
587 |
-
),
|
588 |
-
'on_progress': self.get_crt_callback(future, 'progress'),
|
589 |
-
}
|
590 |
-
|
591 |
-
def get_crt_callback(
|
592 |
-
self,
|
593 |
-
future,
|
594 |
-
callback_type,
|
595 |
-
before_subscribers=None,
|
596 |
-
after_subscribers=None,
|
597 |
-
):
|
598 |
-
def invoke_all_callbacks(*args, **kwargs):
|
599 |
-
callbacks_list = []
|
600 |
-
if before_subscribers is not None:
|
601 |
-
callbacks_list += before_subscribers
|
602 |
-
callbacks_list += get_callbacks(future, callback_type)
|
603 |
-
if after_subscribers is not None:
|
604 |
-
callbacks_list += after_subscribers
|
605 |
-
for callback in callbacks_list:
|
606 |
-
# The get_callbacks helper will set the first augment
|
607 |
-
# by keyword, the other augments need to be set by keyword
|
608 |
-
# as well
|
609 |
-
if callback_type == "progress":
|
610 |
-
callback(bytes_transferred=args[0])
|
611 |
-
else:
|
612 |
-
callback(*args, **kwargs)
|
613 |
-
|
614 |
-
return invoke_all_callbacks
|
615 |
-
|
616 |
-
|
617 |
-
class RenameTempFileHandler:
|
618 |
-
def __init__(self, coordinator, final_filename, temp_filename, osutil):
|
619 |
-
self._coordinator = coordinator
|
620 |
-
self._final_filename = final_filename
|
621 |
-
self._temp_filename = temp_filename
|
622 |
-
self._osutil = osutil
|
623 |
-
|
624 |
-
def __call__(self, **kwargs):
|
625 |
-
error = kwargs['error']
|
626 |
-
if error:
|
627 |
-
self._osutil.remove_file(self._temp_filename)
|
628 |
-
else:
|
629 |
-
try:
|
630 |
-
self._osutil.rename_file(
|
631 |
-
self._temp_filename, self._final_filename
|
632 |
-
)
|
633 |
-
except Exception as e:
|
634 |
-
self._osutil.remove_file(self._temp_filename)
|
635 |
-
# the CRT future has done already at this point
|
636 |
-
self._coordinator.set_exception(e)
|
637 |
-
|
638 |
-
|
639 |
-
class AfterDoneHandler:
|
640 |
-
def __init__(self, coordinator):
|
641 |
-
self._coordinator = coordinator
|
642 |
-
|
643 |
-
def __call__(self, **kwargs):
|
644 |
-
self._coordinator.set_done_callbacks_complete()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Big-Web/MMSD/env/Lib/site-packages/setuptools/_distutils/file_util.py
DELETED
@@ -1,249 +0,0 @@
|
|
1 |
-
"""distutils.file_util
|
2 |
-
|
3 |
-
Utility functions for operating on single files.
|
4 |
-
"""
|
5 |
-
|
6 |
-
import os
|
7 |
-
from distutils.errors import DistutilsFileError
|
8 |
-
from distutils import log
|
9 |
-
|
10 |
-
# for generating verbose output in 'copy_file()'
|
11 |
-
_copy_action = {None: 'copying', 'hard': 'hard linking', 'sym': 'symbolically linking'}
|
12 |
-
|
13 |
-
|
14 |
-
def _copy_file_contents(src, dst, buffer_size=16 * 1024): # noqa: C901
|
15 |
-
"""Copy the file 'src' to 'dst'; both must be filenames. Any error
|
16 |
-
opening either file, reading from 'src', or writing to 'dst', raises
|
17 |
-
DistutilsFileError. Data is read/written in chunks of 'buffer_size'
|
18 |
-
bytes (default 16k). No attempt is made to handle anything apart from
|
19 |
-
regular files.
|
20 |
-
"""
|
21 |
-
# Stolen from shutil module in the standard library, but with
|
22 |
-
# custom error-handling added.
|
23 |
-
fsrc = None
|
24 |
-
fdst = None
|
25 |
-
try:
|
26 |
-
try:
|
27 |
-
fsrc = open(src, 'rb')
|
28 |
-
except OSError as e:
|
29 |
-
raise DistutilsFileError("could not open '{}': {}".format(src, e.strerror))
|
30 |
-
|
31 |
-
if os.path.exists(dst):
|
32 |
-
try:
|
33 |
-
os.unlink(dst)
|
34 |
-
except OSError as e:
|
35 |
-
raise DistutilsFileError(
|
36 |
-
"could not delete '{}': {}".format(dst, e.strerror)
|
37 |
-
)
|
38 |
-
|
39 |
-
try:
|
40 |
-
fdst = open(dst, 'wb')
|
41 |
-
except OSError as e:
|
42 |
-
raise DistutilsFileError(
|
43 |
-
"could not create '{}': {}".format(dst, e.strerror)
|
44 |
-
)
|
45 |
-
|
46 |
-
while True:
|
47 |
-
try:
|
48 |
-
buf = fsrc.read(buffer_size)
|
49 |
-
except OSError as e:
|
50 |
-
raise DistutilsFileError(
|
51 |
-
"could not read from '{}': {}".format(src, e.strerror)
|
52 |
-
)
|
53 |
-
|
54 |
-
if not buf:
|
55 |
-
break
|
56 |
-
|
57 |
-
try:
|
58 |
-
fdst.write(buf)
|
59 |
-
except OSError as e:
|
60 |
-
raise DistutilsFileError(
|
61 |
-
"could not write to '{}': {}".format(dst, e.strerror)
|
62 |
-
)
|
63 |
-
finally:
|
64 |
-
if fdst:
|
65 |
-
fdst.close()
|
66 |
-
if fsrc:
|
67 |
-
fsrc.close()
|
68 |
-
|
69 |
-
|
70 |
-
def copy_file( # noqa: C901
|
71 |
-
src,
|
72 |
-
dst,
|
73 |
-
preserve_mode=1,
|
74 |
-
preserve_times=1,
|
75 |
-
update=0,
|
76 |
-
link=None,
|
77 |
-
verbose=1,
|
78 |
-
dry_run=0,
|
79 |
-
):
|
80 |
-
"""Copy a file 'src' to 'dst'. If 'dst' is a directory, then 'src' is
|
81 |
-
copied there with the same name; otherwise, it must be a filename. (If
|
82 |
-
the file exists, it will be ruthlessly clobbered.) If 'preserve_mode'
|
83 |
-
is true (the default), the file's mode (type and permission bits, or
|
84 |
-
whatever is analogous on the current platform) is copied. If
|
85 |
-
'preserve_times' is true (the default), the last-modified and
|
86 |
-
last-access times are copied as well. If 'update' is true, 'src' will
|
87 |
-
only be copied if 'dst' does not exist, or if 'dst' does exist but is
|
88 |
-
older than 'src'.
|
89 |
-
|
90 |
-
'link' allows you to make hard links (os.link) or symbolic links
|
91 |
-
(os.symlink) instead of copying: set it to "hard" or "sym"; if it is
|
92 |
-
None (the default), files are copied. Don't set 'link' on systems that
|
93 |
-
don't support it: 'copy_file()' doesn't check if hard or symbolic
|
94 |
-
linking is available. If hardlink fails, falls back to
|
95 |
-
_copy_file_contents().
|
96 |
-
|
97 |
-
Under Mac OS, uses the native file copy function in macostools; on
|
98 |
-
other systems, uses '_copy_file_contents()' to copy file contents.
|
99 |
-
|
100 |
-
Return a tuple (dest_name, copied): 'dest_name' is the actual name of
|
101 |
-
the output file, and 'copied' is true if the file was copied (or would
|
102 |
-
have been copied, if 'dry_run' true).
|
103 |
-
"""
|
104 |
-
# XXX if the destination file already exists, we clobber it if
|
105 |
-
# copying, but blow up if linking. Hmmm. And I don't know what
|
106 |
-
# macostools.copyfile() does. Should definitely be consistent, and
|
107 |
-
# should probably blow up if destination exists and we would be
|
108 |
-
# changing it (ie. it's not already a hard/soft link to src OR
|
109 |
-
# (not update) and (src newer than dst).
|
110 |
-
|
111 |
-
from distutils.dep_util import newer
|
112 |
-
from stat import ST_ATIME, ST_MTIME, ST_MODE, S_IMODE
|
113 |
-
|
114 |
-
if not os.path.isfile(src):
|
115 |
-
raise DistutilsFileError(
|
116 |
-
"can't copy '%s': doesn't exist or not a regular file" % src
|
117 |
-
)
|
118 |
-
|
119 |
-
if os.path.isdir(dst):
|
120 |
-
dir = dst
|
121 |
-
dst = os.path.join(dst, os.path.basename(src))
|
122 |
-
else:
|
123 |
-
dir = os.path.dirname(dst)
|
124 |
-
|
125 |
-
if update and not newer(src, dst):
|
126 |
-
if verbose >= 1:
|
127 |
-
log.debug("not copying %s (output up-to-date)", src)
|
128 |
-
return (dst, 0)
|
129 |
-
|
130 |
-
try:
|
131 |
-
action = _copy_action[link]
|
132 |
-
except KeyError:
|
133 |
-
raise ValueError("invalid value '%s' for 'link' argument" % link)
|
134 |
-
|
135 |
-
if verbose >= 1:
|
136 |
-
if os.path.basename(dst) == os.path.basename(src):
|
137 |
-
log.info("%s %s -> %s", action, src, dir)
|
138 |
-
else:
|
139 |
-
log.info("%s %s -> %s", action, src, dst)
|
140 |
-
|
141 |
-
if dry_run:
|
142 |
-
return (dst, 1)
|
143 |
-
|
144 |
-
# If linking (hard or symbolic), use the appropriate system call
|
145 |
-
# (Unix only, of course, but that's the caller's responsibility)
|
146 |
-
elif link == 'hard':
|
147 |
-
if not (os.path.exists(dst) and os.path.samefile(src, dst)):
|
148 |
-
try:
|
149 |
-
os.link(src, dst)
|
150 |
-
return (dst, 1)
|
151 |
-
except OSError:
|
152 |
-
# If hard linking fails, fall back on copying file
|
153 |
-
# (some special filesystems don't support hard linking
|
154 |
-
# even under Unix, see issue #8876).
|
155 |
-
pass
|
156 |
-
elif link == 'sym':
|
157 |
-
if not (os.path.exists(dst) and os.path.samefile(src, dst)):
|
158 |
-
os.symlink(src, dst)
|
159 |
-
return (dst, 1)
|
160 |
-
|
161 |
-
# Otherwise (non-Mac, not linking), copy the file contents and
|
162 |
-
# (optionally) copy the times and mode.
|
163 |
-
_copy_file_contents(src, dst)
|
164 |
-
if preserve_mode or preserve_times:
|
165 |
-
st = os.stat(src)
|
166 |
-
|
167 |
-
# According to David Ascher <[email protected]>, utime() should be done
|
168 |
-
# before chmod() (at least under NT).
|
169 |
-
if preserve_times:
|
170 |
-
os.utime(dst, (st[ST_ATIME], st[ST_MTIME]))
|
171 |
-
if preserve_mode:
|
172 |
-
os.chmod(dst, S_IMODE(st[ST_MODE]))
|
173 |
-
|
174 |
-
return (dst, 1)
|
175 |
-
|
176 |
-
|
177 |
-
# XXX I suspect this is Unix-specific -- need porting help!
|
178 |
-
def move_file(src, dst, verbose=1, dry_run=0): # noqa: C901
|
179 |
-
|
180 |
-
"""Move a file 'src' to 'dst'. If 'dst' is a directory, the file will
|
181 |
-
be moved into it with the same name; otherwise, 'src' is just renamed
|
182 |
-
to 'dst'. Return the new full name of the file.
|
183 |
-
|
184 |
-
Handles cross-device moves on Unix using 'copy_file()'. What about
|
185 |
-
other systems???
|
186 |
-
"""
|
187 |
-
from os.path import exists, isfile, isdir, basename, dirname
|
188 |
-
import errno
|
189 |
-
|
190 |
-
if verbose >= 1:
|
191 |
-
log.info("moving %s -> %s", src, dst)
|
192 |
-
|
193 |
-
if dry_run:
|
194 |
-
return dst
|
195 |
-
|
196 |
-
if not isfile(src):
|
197 |
-
raise DistutilsFileError("can't move '%s': not a regular file" % src)
|
198 |
-
|
199 |
-
if isdir(dst):
|
200 |
-
dst = os.path.join(dst, basename(src))
|
201 |
-
elif exists(dst):
|
202 |
-
raise DistutilsFileError(
|
203 |
-
"can't move '{}': destination '{}' already exists".format(src, dst)
|
204 |
-
)
|
205 |
-
|
206 |
-
if not isdir(dirname(dst)):
|
207 |
-
raise DistutilsFileError(
|
208 |
-
"can't move '{}': destination '{}' not a valid path".format(src, dst)
|
209 |
-
)
|
210 |
-
|
211 |
-
copy_it = False
|
212 |
-
try:
|
213 |
-
os.rename(src, dst)
|
214 |
-
except OSError as e:
|
215 |
-
(num, msg) = e.args
|
216 |
-
if num == errno.EXDEV:
|
217 |
-
copy_it = True
|
218 |
-
else:
|
219 |
-
raise DistutilsFileError(
|
220 |
-
"couldn't move '{}' to '{}': {}".format(src, dst, msg)
|
221 |
-
)
|
222 |
-
|
223 |
-
if copy_it:
|
224 |
-
copy_file(src, dst, verbose=verbose)
|
225 |
-
try:
|
226 |
-
os.unlink(src)
|
227 |
-
except OSError as e:
|
228 |
-
(num, msg) = e.args
|
229 |
-
try:
|
230 |
-
os.unlink(dst)
|
231 |
-
except OSError:
|
232 |
-
pass
|
233 |
-
raise DistutilsFileError(
|
234 |
-
"couldn't move '%s' to '%s' by copy/delete: "
|
235 |
-
"delete '%s' failed: %s" % (src, dst, src, msg)
|
236 |
-
)
|
237 |
-
return dst
|
238 |
-
|
239 |
-
|
240 |
-
def write_file(filename, contents):
|
241 |
-
"""Create a file with the specified name and write 'contents' (a
|
242 |
-
sequence of strings without line terminators) to it.
|
243 |
-
"""
|
244 |
-
f = open(filename, "w")
|
245 |
-
try:
|
246 |
-
for line in contents:
|
247 |
-
f.write(line + "\n")
|
248 |
-
finally:
|
249 |
-
f.close()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Billyosoro/ESRGAN/realesrgan/archs/__init__.py
DELETED
@@ -1,10 +0,0 @@
|
|
1 |
-
import importlib
|
2 |
-
from basicsr.utils import scandir
|
3 |
-
from os import path as osp
|
4 |
-
|
5 |
-
# automatically scan and import arch modules for registry
|
6 |
-
# scan all the files that end with '_arch.py' under the archs folder
|
7 |
-
arch_folder = osp.dirname(osp.abspath(__file__))
|
8 |
-
arch_filenames = [osp.splitext(osp.basename(v))[0] for v in scandir(arch_folder) if v.endswith('_arch.py')]
|
9 |
-
# import all the arch modules
|
10 |
-
_arch_modules = [importlib.import_module(f'realesrgan.archs.{file_name}') for file_name in arch_filenames]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/BuBBLe1q/anything-v3.0/app.py
DELETED
@@ -1,8 +0,0 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
|
3 |
-
description = """<div>
|
4 |
-
<img src="https://i.imgur.com/FEA7N1p.png">
|
5 |
-
</div>
|
6 |
-
"""
|
7 |
-
|
8 |
-
gr.Interface.load("models/Linaqruf/anything-v3.0", description=description).launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/CVPR/LIVE/thrust/thrust/iterator/detail/iterator_category_to_system.h
DELETED
@@ -1,80 +0,0 @@
|
|
1 |
-
/*
|
2 |
-
* Copyright 2008-2013 NVIDIA Corporation
|
3 |
-
*
|
4 |
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
5 |
-
* you may not use this file except in compliance with the License.
|
6 |
-
* You may obtain a copy of the License at
|
7 |
-
*
|
8 |
-
* http://www.apache.org/licenses/LICENSE-2.0
|
9 |
-
*
|
10 |
-
* Unless required by applicable law or agreed to in writing, software
|
11 |
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
12 |
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 |
-
* See the License for the specific language governing permissions and
|
14 |
-
* limitations under the License.
|
15 |
-
*/
|
16 |
-
|
17 |
-
#pragma once
|
18 |
-
|
19 |
-
#include <thrust/detail/config.h>
|
20 |
-
#include <thrust/iterator/iterator_categories.h>
|
21 |
-
#include <thrust/iterator/detail/iterator_traversal_tags.h>
|
22 |
-
#include <thrust/iterator/detail/host_system_tag.h>
|
23 |
-
#include <thrust/iterator/detail/device_system_tag.h>
|
24 |
-
#include <thrust/iterator/detail/any_system_tag.h>
|
25 |
-
#include <thrust/detail/type_traits.h>
|
26 |
-
|
27 |
-
namespace thrust
|
28 |
-
{
|
29 |
-
|
30 |
-
namespace detail
|
31 |
-
{
|
32 |
-
|
33 |
-
// forward declaration
|
34 |
-
template <typename> struct is_iterator_system;
|
35 |
-
|
36 |
-
template <typename> struct device_iterator_category_to_backend_system;
|
37 |
-
|
38 |
-
// XXX this should work entirely differently
|
39 |
-
// we should just specialize this metafunction for iterator_category_with_system_and_traversal
|
40 |
-
template<typename Category>
|
41 |
-
struct iterator_category_to_system
|
42 |
-
// convertible to host iterator?
|
43 |
-
: eval_if<
|
44 |
-
or_<
|
45 |
-
is_convertible<Category, thrust::input_host_iterator_tag>,
|
46 |
-
is_convertible<Category, thrust::output_host_iterator_tag>
|
47 |
-
>::value,
|
48 |
-
|
49 |
-
detail::identity_<thrust::host_system_tag>,
|
50 |
-
|
51 |
-
// convertible to device iterator?
|
52 |
-
eval_if<
|
53 |
-
or_<
|
54 |
-
is_convertible<Category, thrust::input_device_iterator_tag>,
|
55 |
-
is_convertible<Category, thrust::output_device_iterator_tag>
|
56 |
-
>::value,
|
57 |
-
|
58 |
-
detail::identity_<thrust::device_system_tag>,
|
59 |
-
|
60 |
-
// unknown system
|
61 |
-
detail::identity_<void>
|
62 |
-
> // if device
|
63 |
-
> // if host
|
64 |
-
{
|
65 |
-
}; // end iterator_category_to_system
|
66 |
-
|
67 |
-
|
68 |
-
template<typename CategoryOrTraversal>
|
69 |
-
struct iterator_category_or_traversal_to_system
|
70 |
-
: eval_if<
|
71 |
-
is_iterator_system<CategoryOrTraversal>::value,
|
72 |
-
detail::identity_<CategoryOrTraversal>,
|
73 |
-
iterator_category_to_system<CategoryOrTraversal>
|
74 |
-
>
|
75 |
-
{
|
76 |
-
}; // end iterator_category_or_traversal_to_system
|
77 |
-
|
78 |
-
} // end detail
|
79 |
-
} // end thrust
|
80 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/CVPR/LIVE/thrust/thrust/system/omp/detail/scan.h
DELETED
@@ -1,23 +0,0 @@
|
|
1 |
-
/*
|
2 |
-
* Copyright 2008-2013 NVIDIA Corporation
|
3 |
-
*
|
4 |
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
5 |
-
* you may not use this file except in compliance with the License.
|
6 |
-
* You may obtain a copy of the License at
|
7 |
-
*
|
8 |
-
* http://www.apache.org/licenses/LICENSE-2.0
|
9 |
-
*
|
10 |
-
* Unless required by applicable law or agreed to in writing, software
|
11 |
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
12 |
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 |
-
* See the License for the specific language governing permissions and
|
14 |
-
* limitations under the License.
|
15 |
-
*/
|
16 |
-
|
17 |
-
#pragma once
|
18 |
-
|
19 |
-
#include <thrust/detail/config.h>
|
20 |
-
|
21 |
-
// this system inherits scan
|
22 |
-
#include <thrust/system/cpp/detail/scan.h>
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/CVPR/WALT/configs/_base_/datasets/walt_vehicle.py
DELETED
@@ -1,49 +0,0 @@
|
|
1 |
-
dataset_type = 'WaltDataset'
|
2 |
-
data_root = 'data/cwalt_train/'
|
3 |
-
data_root_test = 'data/cwalt_test/'
|
4 |
-
img_norm_cfg = dict(
|
5 |
-
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
|
6 |
-
train_pipeline = [
|
7 |
-
dict(type='LoadImageFromFile'),
|
8 |
-
dict(type='LoadAnnotations', with_bbox=True, with_mask=True),
|
9 |
-
dict(type='Resize', img_scale=(1333, 800), keep_ratio=True),
|
10 |
-
dict(type='RandomFlip', flip_ratio=0.5),
|
11 |
-
dict(type='Normalize', **img_norm_cfg),
|
12 |
-
dict(type='Pad', size_divisor=32),
|
13 |
-
dict(type='DefaultFormatBundle'),
|
14 |
-
dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels', 'gt_masks']),
|
15 |
-
]
|
16 |
-
test_pipeline = [
|
17 |
-
dict(type='LoadImageFromFile'),
|
18 |
-
dict(
|
19 |
-
type='MultiScaleFlipAug',
|
20 |
-
img_scale=(1333, 800),
|
21 |
-
flip=False,
|
22 |
-
transforms=[
|
23 |
-
dict(type='Resize', keep_ratio=True),
|
24 |
-
dict(type='RandomFlip'),
|
25 |
-
dict(type='Normalize', **img_norm_cfg),
|
26 |
-
dict(type='Pad', size_divisor=32),
|
27 |
-
dict(type='ImageToTensor', keys=['img']),
|
28 |
-
dict(type='Collect', keys=['img']),
|
29 |
-
])
|
30 |
-
]
|
31 |
-
data = dict(
|
32 |
-
samples_per_gpu=5,
|
33 |
-
workers_per_gpu=5,
|
34 |
-
train=dict(
|
35 |
-
type=dataset_type,
|
36 |
-
ann_file=data_root + '/',
|
37 |
-
img_prefix=data_root + '/',
|
38 |
-
pipeline=train_pipeline),
|
39 |
-
val=dict(
|
40 |
-
type=dataset_type,
|
41 |
-
ann_file=data_root_test + '/',
|
42 |
-
img_prefix=data_root_test + '/',
|
43 |
-
pipeline=test_pipeline),
|
44 |
-
test=dict(
|
45 |
-
type=dataset_type,
|
46 |
-
ann_file=data_root_test + '/',
|
47 |
-
img_prefix=data_root_test + '/',
|
48 |
-
pipeline=test_pipeline))
|
49 |
-
evaluation = dict(metric=['bbox', 'segm'])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/CVPR/lama-example/models/ade20k/segm_lib/nn/modules/unittest.py
DELETED
@@ -1,29 +0,0 @@
|
|
1 |
-
# -*- coding: utf-8 -*-
|
2 |
-
# File : unittest.py
|
3 |
-
# Author : Jiayuan Mao
|
4 |
-
# Email : [email protected]
|
5 |
-
# Date : 27/01/2018
|
6 |
-
#
|
7 |
-
# This file is part of Synchronized-BatchNorm-PyTorch.
|
8 |
-
# https://github.com/vacancy/Synchronized-BatchNorm-PyTorch
|
9 |
-
# Distributed under MIT License.
|
10 |
-
|
11 |
-
import unittest
|
12 |
-
|
13 |
-
import numpy as np
|
14 |
-
from torch.autograd import Variable
|
15 |
-
|
16 |
-
|
17 |
-
def as_numpy(v):
|
18 |
-
if isinstance(v, Variable):
|
19 |
-
v = v.data
|
20 |
-
return v.cpu().numpy()
|
21 |
-
|
22 |
-
|
23 |
-
class TorchTestCase(unittest.TestCase):
|
24 |
-
def assertTensorClose(self, a, b, atol=1e-3, rtol=1e-3):
|
25 |
-
npa, npb = as_numpy(a), as_numpy(b)
|
26 |
-
self.assertTrue(
|
27 |
-
np.allclose(npa, npb, atol=atol),
|
28 |
-
'Tensor close check failed\n{}\n{}\nadiff={}, rdiff={}'.format(a, b, np.abs(npa - npb).max(), np.abs((npa - npb) / np.fmax(npa, 1e-5)).max())
|
29 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/ChrisCaviar/ControlNet-v1-1/depth_estimator.py
DELETED
@@ -1,25 +0,0 @@
|
|
1 |
-
import numpy as np
|
2 |
-
import PIL.Image
|
3 |
-
from controlnet_aux.util import HWC3
|
4 |
-
from transformers import pipeline
|
5 |
-
|
6 |
-
from cv_utils import resize_image
|
7 |
-
|
8 |
-
|
9 |
-
class DepthEstimator:
|
10 |
-
def __init__(self):
|
11 |
-
self.model = pipeline('depth-estimation')
|
12 |
-
|
13 |
-
def __call__(self, image: np.ndarray, **kwargs) -> PIL.Image.Image:
|
14 |
-
detect_resolution = kwargs.pop('detect_resolution', 512)
|
15 |
-
image_resolution = kwargs.pop('image_resolution', 512)
|
16 |
-
image = np.array(image)
|
17 |
-
image = HWC3(image)
|
18 |
-
image = resize_image(image, resolution=detect_resolution)
|
19 |
-
image = PIL.Image.fromarray(image)
|
20 |
-
image = self.model(image)
|
21 |
-
image = image['depth']
|
22 |
-
image = np.array(image)
|
23 |
-
image = HWC3(image)
|
24 |
-
image = resize_image(image, resolution=image_resolution)
|
25 |
-
return PIL.Image.fromarray(image)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Cong723/gpt-academic-public/crazy_functions/test_project/cpp/libJPG/jpge.h
DELETED
@@ -1,172 +0,0 @@
|
|
1 |
-
|
2 |
-
// jpge.h - C++ class for JPEG compression.
|
3 |
-
// Public domain, Rich Geldreich <[email protected]>
|
4 |
-
// Alex Evans: Added RGBA support, linear memory allocator.
|
5 |
-
#ifndef JPEG_ENCODER_H
|
6 |
-
#define JPEG_ENCODER_H
|
7 |
-
|
8 |
-
#include <stdint.h>
|
9 |
-
|
10 |
-
namespace jpge
|
11 |
-
{
|
12 |
-
typedef unsigned char uint8;
|
13 |
-
typedef signed short int16;
|
14 |
-
typedef signed int int32;
|
15 |
-
typedef unsigned short uint16;
|
16 |
-
typedef unsigned int uint32;
|
17 |
-
typedef unsigned int uint;
|
18 |
-
|
19 |
-
// JPEG chroma subsampling factors. Y_ONLY (grayscale images) and H2V2 (color images) are the most common.
|
20 |
-
enum subsampling_t { Y_ONLY = 0, H1V1 = 1, H2V1 = 2, H2V2 = 3 };
|
21 |
-
|
22 |
-
// JPEG compression parameters structure.
|
23 |
-
struct params
|
24 |
-
{
|
25 |
-
inline params() : m_quality(85), m_subsampling(H2V2), m_no_chroma_discrim_flag(false), m_two_pass_flag(false) { }
|
26 |
-
|
27 |
-
inline bool check_valid() const
|
28 |
-
{
|
29 |
-
if ((m_quality < 1) || (m_quality > 100)) return false;
|
30 |
-
if ((uint)m_subsampling > (uint)H2V2) return false;
|
31 |
-
return true;
|
32 |
-
}
|
33 |
-
|
34 |
-
// Quality: 1-100, higher is better. Typical values are around 50-95.
|
35 |
-
int m_quality;
|
36 |
-
|
37 |
-
// m_subsampling:
|
38 |
-
// 0 = Y (grayscale) only
|
39 |
-
// 1 = YCbCr, no subsampling (H1V1, YCbCr 1x1x1, 3 blocks per MCU)
|
40 |
-
// 2 = YCbCr, H2V1 subsampling (YCbCr 2x1x1, 4 blocks per MCU)
|
41 |
-
// 3 = YCbCr, H2V2 subsampling (YCbCr 4x1x1, 6 blocks per MCU-- very common)
|
42 |
-
subsampling_t m_subsampling;
|
43 |
-
|
44 |
-
// Disables CbCr discrimination - only intended for testing.
|
45 |
-
// If true, the Y quantization table is also used for the CbCr channels.
|
46 |
-
bool m_no_chroma_discrim_flag;
|
47 |
-
|
48 |
-
bool m_two_pass_flag;
|
49 |
-
};
|
50 |
-
|
51 |
-
// Writes JPEG image to a file.
|
52 |
-
// num_channels must be 1 (Y) or 3 (RGB), image pitch must be width*num_channels.
|
53 |
-
bool compress_image_to_jpeg_file(const char *pFilename, int64_t width, int64_t height, int64_t num_channels, const uint8 *pImage_data, const params &comp_params = params());
|
54 |
-
|
55 |
-
// Writes JPEG image to memory buffer.
|
56 |
-
// On entry, buf_size is the size of the output buffer pointed at by pBuf, which should be at least ~1024 bytes.
|
57 |
-
// If return value is true, buf_size will be set to the size of the compressed data.
|
58 |
-
bool compress_image_to_jpeg_file_in_memory(void *pBuf, int64_t &buf_size, int64_t width, int64_t height, int64_t num_channels, const uint8 *pImage_data, const params &comp_params = params());
|
59 |
-
|
60 |
-
// Output stream abstract class - used by the jpeg_encoder class to write to the output stream.
|
61 |
-
// put_buf() is generally called with len==JPGE_OUT_BUF_SIZE bytes, but for headers it'll be called with smaller amounts.
|
62 |
-
class output_stream
|
63 |
-
{
|
64 |
-
public:
|
65 |
-
virtual ~output_stream() { };
|
66 |
-
virtual bool put_buf(const void* Pbuf, int64_t len) = 0;
|
67 |
-
template<class T> inline bool put_obj(const T& obj) { return put_buf(&obj, sizeof(T)); }
|
68 |
-
};
|
69 |
-
|
70 |
-
// Lower level jpeg_encoder class - useful if more control is needed than the above helper functions.
|
71 |
-
class jpeg_encoder
|
72 |
-
{
|
73 |
-
public:
|
74 |
-
jpeg_encoder();
|
75 |
-
~jpeg_encoder();
|
76 |
-
|
77 |
-
// Initializes the compressor.
|
78 |
-
// pStream: The stream object to use for writing compressed data.
|
79 |
-
// params - Compression parameters structure, defined above.
|
80 |
-
// width, height - Image dimensions.
|
81 |
-
// channels - May be 1, or 3. 1 indicates grayscale, 3 indicates RGB source data.
|
82 |
-
// Returns false on out of memory or if a stream write fails.
|
83 |
-
bool init(output_stream *pStream, int64_t width, int64_t height, int64_t src_channels, const params &comp_params = params());
|
84 |
-
|
85 |
-
const params &get_params() const { return m_params; }
|
86 |
-
|
87 |
-
// Deinitializes the compressor, freeing any allocated memory. May be called at any time.
|
88 |
-
void deinit();
|
89 |
-
|
90 |
-
uint get_total_passes() const { return m_params.m_two_pass_flag ? 2 : 1; }
|
91 |
-
inline uint get_cur_pass() { return m_pass_num; }
|
92 |
-
|
93 |
-
// Call this method with each source scanline.
|
94 |
-
// width * src_channels bytes per scanline is expected (RGB or Y format).
|
95 |
-
// You must call with NULL after all scanlines are processed to finish compression.
|
96 |
-
// Returns false on out of memory or if a stream write fails.
|
97 |
-
bool process_scanline(const void* pScanline);
|
98 |
-
|
99 |
-
private:
|
100 |
-
jpeg_encoder(const jpeg_encoder &);
|
101 |
-
jpeg_encoder &operator =(const jpeg_encoder &);
|
102 |
-
|
103 |
-
typedef int32 sample_array_t;
|
104 |
-
|
105 |
-
output_stream *m_pStream;
|
106 |
-
params m_params;
|
107 |
-
uint8 m_num_components;
|
108 |
-
uint8 m_comp_h_samp[3], m_comp_v_samp[3];
|
109 |
-
int m_image_x, m_image_y, m_image_bpp, m_image_bpl;
|
110 |
-
int m_image_x_mcu, m_image_y_mcu;
|
111 |
-
int m_image_bpl_xlt, m_image_bpl_mcu;
|
112 |
-
int m_mcus_per_row;
|
113 |
-
int m_mcu_x, m_mcu_y;
|
114 |
-
uint8 *m_mcu_lines[16];
|
115 |
-
uint8 m_mcu_y_ofs;
|
116 |
-
sample_array_t m_sample_array[64];
|
117 |
-
int16 m_coefficient_array[64];
|
118 |
-
int32 m_quantization_tables[2][64];
|
119 |
-
uint m_huff_codes[4][256];
|
120 |
-
uint8 m_huff_code_sizes[4][256];
|
121 |
-
uint8 m_huff_bits[4][17];
|
122 |
-
uint8 m_huff_val[4][256];
|
123 |
-
uint32 m_huff_count[4][256];
|
124 |
-
int m_last_dc_val[3];
|
125 |
-
enum { JPGE_OUT_BUF_SIZE = 2048 };
|
126 |
-
uint8 m_out_buf[JPGE_OUT_BUF_SIZE];
|
127 |
-
uint8 *m_pOut_buf;
|
128 |
-
uint m_out_buf_left;
|
129 |
-
uint32 m_bit_buffer;
|
130 |
-
uint m_bits_in;
|
131 |
-
uint8 m_pass_num;
|
132 |
-
bool m_all_stream_writes_succeeded;
|
133 |
-
|
134 |
-
void optimize_huffman_table(int table_num, int table_len);
|
135 |
-
void emit_byte(uint8 i);
|
136 |
-
void emit_word(uint i);
|
137 |
-
void emit_marker(int marker);
|
138 |
-
void emit_jfif_app0();
|
139 |
-
void emit_dqt();
|
140 |
-
void emit_sof();
|
141 |
-
void emit_dht(uint8 *bits, uint8 *val, int index, bool ac_flag);
|
142 |
-
void emit_dhts();
|
143 |
-
void emit_sos();
|
144 |
-
void emit_markers();
|
145 |
-
void compute_huffman_table(uint *codes, uint8 *code_sizes, uint8 *bits, uint8 *val);
|
146 |
-
void compute_quant_table(int32 *dst, int16 *src);
|
147 |
-
void adjust_quant_table(int32 *dst, int32 *src);
|
148 |
-
void first_pass_init();
|
149 |
-
bool second_pass_init();
|
150 |
-
bool jpg_open(int p_x_res, int p_y_res, int src_channels);
|
151 |
-
void load_block_8_8_grey(int x);
|
152 |
-
void load_block_8_8(int x, int y, int c);
|
153 |
-
void load_block_16_8(int x, int c);
|
154 |
-
void load_block_16_8_8(int x, int c);
|
155 |
-
void load_quantized_coefficients(int component_num);
|
156 |
-
void flush_output_buffer();
|
157 |
-
void put_bits(uint bits, uint len);
|
158 |
-
void code_coefficients_pass_one(int component_num);
|
159 |
-
void code_coefficients_pass_two(int component_num);
|
160 |
-
void code_block(int component_num);
|
161 |
-
void process_mcu_row();
|
162 |
-
bool terminate_pass_one();
|
163 |
-
bool terminate_pass_two();
|
164 |
-
bool process_end_of_image();
|
165 |
-
void load_mcu(const void* src);
|
166 |
-
void clear();
|
167 |
-
void init();
|
168 |
-
};
|
169 |
-
|
170 |
-
} // namespace jpge
|
171 |
-
|
172 |
-
#endif // JPEG_ENCODER
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Cong723/gpt-academic-public/request_llm/bridge_all.py
DELETED
@@ -1,240 +0,0 @@
|
|
1 |
-
|
2 |
-
"""
|
3 |
-
该文件中主要包含2个函数,是所有LLM的通用接口,它们会继续向下调用更底层的LLM模型,处理多模型并行等细节
|
4 |
-
|
5 |
-
不具备多线程能力的函数:正常对话时使用,具备完备的交互功能,不可多线程
|
6 |
-
1. predict(...)
|
7 |
-
|
8 |
-
具备多线程调用能力的函数:在函数插件中被调用,灵活而简洁
|
9 |
-
2. predict_no_ui_long_connection(...)
|
10 |
-
"""
|
11 |
-
import tiktoken
|
12 |
-
from functools import lru_cache
|
13 |
-
from concurrent.futures import ThreadPoolExecutor
|
14 |
-
from toolbox import get_conf, trimmed_format_exc
|
15 |
-
|
16 |
-
from .bridge_chatgpt import predict_no_ui_long_connection as chatgpt_noui
|
17 |
-
from .bridge_chatgpt import predict as chatgpt_ui
|
18 |
-
|
19 |
-
from .bridge_chatglm import predict_no_ui_long_connection as chatglm_noui
|
20 |
-
from .bridge_chatglm import predict as chatglm_ui
|
21 |
-
|
22 |
-
from .bridge_newbing import predict_no_ui_long_connection as newbing_noui
|
23 |
-
from .bridge_newbing import predict as newbing_ui
|
24 |
-
|
25 |
-
# from .bridge_tgui import predict_no_ui_long_connection as tgui_noui
|
26 |
-
# from .bridge_tgui import predict as tgui_ui
|
27 |
-
|
28 |
-
colors = ['#FF00FF', '#00FFFF', '#FF0000', '#990099', '#009999', '#990044']
|
29 |
-
|
30 |
-
class LazyloadTiktoken(object):
|
31 |
-
def __init__(self, model):
|
32 |
-
self.model = model
|
33 |
-
|
34 |
-
@staticmethod
|
35 |
-
@lru_cache(maxsize=128)
|
36 |
-
def get_encoder(model):
|
37 |
-
print('正在加载tokenizer,如果是第一次运行,可能需要一点时间下载参数')
|
38 |
-
tmp = tiktoken.encoding_for_model(model)
|
39 |
-
print('加载tokenizer完毕')
|
40 |
-
return tmp
|
41 |
-
|
42 |
-
def encode(self, *args, **kwargs):
|
43 |
-
encoder = self.get_encoder(self.model)
|
44 |
-
return encoder.encode(*args, **kwargs)
|
45 |
-
|
46 |
-
def decode(self, *args, **kwargs):
|
47 |
-
encoder = self.get_encoder(self.model)
|
48 |
-
return encoder.decode(*args, **kwargs)
|
49 |
-
|
50 |
-
# Endpoint 重定向
|
51 |
-
API_URL_REDIRECT, = get_conf("API_URL_REDIRECT")
|
52 |
-
openai_endpoint = "https://api.openai.com/v1/chat/completions"
|
53 |
-
api2d_endpoint = "https://openai.api2d.net/v1/chat/completions"
|
54 |
-
newbing_endpoint = "wss://sydney.bing.com/sydney/ChatHub"
|
55 |
-
# 兼容旧版的配置
|
56 |
-
try:
|
57 |
-
API_URL, = get_conf("API_URL")
|
58 |
-
if API_URL != "https://api.openai.com/v1/chat/completions":
|
59 |
-
openai_endpoint = API_URL
|
60 |
-
print("警告!API_URL配置选项将被弃用,请更换为API_URL_REDIRECT配置")
|
61 |
-
except:
|
62 |
-
pass
|
63 |
-
# 新版配置
|
64 |
-
if openai_endpoint in API_URL_REDIRECT: openai_endpoint = API_URL_REDIRECT[openai_endpoint]
|
65 |
-
if api2d_endpoint in API_URL_REDIRECT: api2d_endpoint = API_URL_REDIRECT[api2d_endpoint]
|
66 |
-
if newbing_endpoint in API_URL_REDIRECT: newbing_endpoint = API_URL_REDIRECT[newbing_endpoint]
|
67 |
-
|
68 |
-
|
69 |
-
# 获取tokenizer
|
70 |
-
tokenizer_gpt35 = LazyloadTiktoken("gpt-3.5-turbo")
|
71 |
-
tokenizer_gpt4 = LazyloadTiktoken("gpt-4")
|
72 |
-
get_token_num_gpt35 = lambda txt: len(tokenizer_gpt35.encode(txt, disallowed_special=()))
|
73 |
-
get_token_num_gpt4 = lambda txt: len(tokenizer_gpt4.encode(txt, disallowed_special=()))
|
74 |
-
|
75 |
-
|
76 |
-
model_info = {
|
77 |
-
# openai
|
78 |
-
"gpt-3.5-turbo": {
|
79 |
-
"fn_with_ui": chatgpt_ui,
|
80 |
-
"fn_without_ui": chatgpt_noui,
|
81 |
-
"endpoint": openai_endpoint,
|
82 |
-
"max_token": 4096,
|
83 |
-
"tokenizer": tokenizer_gpt35,
|
84 |
-
"token_cnt": get_token_num_gpt35,
|
85 |
-
},
|
86 |
-
|
87 |
-
"gpt-4": {
|
88 |
-
"fn_with_ui": chatgpt_ui,
|
89 |
-
"fn_without_ui": chatgpt_noui,
|
90 |
-
"endpoint": openai_endpoint,
|
91 |
-
"max_token": 8192,
|
92 |
-
"tokenizer": tokenizer_gpt4,
|
93 |
-
"token_cnt": get_token_num_gpt4,
|
94 |
-
},
|
95 |
-
|
96 |
-
# api_2d
|
97 |
-
"api2d-gpt-3.5-turbo": {
|
98 |
-
"fn_with_ui": chatgpt_ui,
|
99 |
-
"fn_without_ui": chatgpt_noui,
|
100 |
-
"endpoint": api2d_endpoint,
|
101 |
-
"max_token": 4096,
|
102 |
-
"tokenizer": tokenizer_gpt35,
|
103 |
-
"token_cnt": get_token_num_gpt35,
|
104 |
-
},
|
105 |
-
|
106 |
-
"api2d-gpt-4": {
|
107 |
-
"fn_with_ui": chatgpt_ui,
|
108 |
-
"fn_without_ui": chatgpt_noui,
|
109 |
-
"endpoint": api2d_endpoint,
|
110 |
-
"max_token": 8192,
|
111 |
-
"tokenizer": tokenizer_gpt4,
|
112 |
-
"token_cnt": get_token_num_gpt4,
|
113 |
-
},
|
114 |
-
|
115 |
-
# chatglm
|
116 |
-
"chatglm": {
|
117 |
-
"fn_with_ui": chatglm_ui,
|
118 |
-
"fn_without_ui": chatglm_noui,
|
119 |
-
"endpoint": None,
|
120 |
-
"max_token": 1024,
|
121 |
-
"tokenizer": tokenizer_gpt35,
|
122 |
-
"token_cnt": get_token_num_gpt35,
|
123 |
-
},
|
124 |
-
# newbing
|
125 |
-
"newbing": {
|
126 |
-
"fn_with_ui": newbing_ui,
|
127 |
-
"fn_without_ui": newbing_noui,
|
128 |
-
"endpoint": newbing_endpoint,
|
129 |
-
"max_token": 4096,
|
130 |
-
"tokenizer": tokenizer_gpt35,
|
131 |
-
"token_cnt": get_token_num_gpt35,
|
132 |
-
},
|
133 |
-
}
|
134 |
-
|
135 |
-
|
136 |
-
def LLM_CATCH_EXCEPTION(f):
|
137 |
-
"""
|
138 |
-
装饰器函数,将错误显示出来
|
139 |
-
"""
|
140 |
-
def decorated(inputs, llm_kwargs, history, sys_prompt, observe_window, console_slience):
|
141 |
-
try:
|
142 |
-
return f(inputs, llm_kwargs, history, sys_prompt, observe_window, console_slience)
|
143 |
-
except Exception as e:
|
144 |
-
tb_str = '\n```\n' + trimmed_format_exc() + '\n```\n'
|
145 |
-
observe_window[0] = tb_str
|
146 |
-
return tb_str
|
147 |
-
return decorated
|
148 |
-
|
149 |
-
|
150 |
-
def predict_no_ui_long_connection(inputs, llm_kwargs, history, sys_prompt, observe_window, console_slience=False):
|
151 |
-
"""
|
152 |
-
发送至LLM,等待回复,一次性完成,不显示中间过程。但内部用stream的方法避免中途网线被掐。
|
153 |
-
inputs:
|
154 |
-
是本次问询的输入
|
155 |
-
sys_prompt:
|
156 |
-
系统静默prompt
|
157 |
-
llm_kwargs:
|
158 |
-
LLM的内部调优参数
|
159 |
-
history:
|
160 |
-
是之前的对话列表
|
161 |
-
observe_window = None:
|
162 |
-
用于负责跨越线程传递已经输出的部分,大部分时候仅仅为了fancy的视觉效果,留空即可。observe_window[0]:观测窗。observe_window[1]:看门狗
|
163 |
-
"""
|
164 |
-
import threading, time, copy
|
165 |
-
|
166 |
-
model = llm_kwargs['llm_model']
|
167 |
-
n_model = 1
|
168 |
-
if '&' not in model:
|
169 |
-
assert not model.startswith("tgui"), "TGUI不支持函数插件的实现"
|
170 |
-
|
171 |
-
# 如果只询问1个大语言模型:
|
172 |
-
method = model_info[model]["fn_without_ui"]
|
173 |
-
return method(inputs, llm_kwargs, history, sys_prompt, observe_window, console_slience)
|
174 |
-
else:
|
175 |
-
# 如果同时询问多个大语言模型:
|
176 |
-
executor = ThreadPoolExecutor(max_workers=4)
|
177 |
-
models = model.split('&')
|
178 |
-
n_model = len(models)
|
179 |
-
|
180 |
-
window_len = len(observe_window)
|
181 |
-
assert window_len==3
|
182 |
-
window_mutex = [["", time.time(), ""] for _ in range(n_model)] + [True]
|
183 |
-
|
184 |
-
futures = []
|
185 |
-
for i in range(n_model):
|
186 |
-
model = models[i]
|
187 |
-
method = model_info[model]["fn_without_ui"]
|
188 |
-
llm_kwargs_feedin = copy.deepcopy(llm_kwargs)
|
189 |
-
llm_kwargs_feedin['llm_model'] = model
|
190 |
-
future = executor.submit(LLM_CATCH_EXCEPTION(method), inputs, llm_kwargs_feedin, history, sys_prompt, window_mutex[i], console_slience)
|
191 |
-
futures.append(future)
|
192 |
-
|
193 |
-
def mutex_manager(window_mutex, observe_window):
|
194 |
-
while True:
|
195 |
-
time.sleep(0.25)
|
196 |
-
if not window_mutex[-1]: break
|
197 |
-
# 看门狗(watchdog)
|
198 |
-
for i in range(n_model):
|
199 |
-
window_mutex[i][1] = observe_window[1]
|
200 |
-
# 观察窗(window)
|
201 |
-
chat_string = []
|
202 |
-
for i in range(n_model):
|
203 |
-
chat_string.append( f"【{str(models[i])} 说】: <font color=\"{colors[i]}\"> {window_mutex[i][0]} </font>" )
|
204 |
-
res = '<br/><br/>\n\n---\n\n'.join(chat_string)
|
205 |
-
# # # # # # # # # # #
|
206 |
-
observe_window[0] = res
|
207 |
-
|
208 |
-
t_model = threading.Thread(target=mutex_manager, args=(window_mutex, observe_window), daemon=True)
|
209 |
-
t_model.start()
|
210 |
-
|
211 |
-
return_string_collect = []
|
212 |
-
while True:
|
213 |
-
worker_done = [h.done() for h in futures]
|
214 |
-
if all(worker_done):
|
215 |
-
executor.shutdown()
|
216 |
-
break
|
217 |
-
time.sleep(1)
|
218 |
-
|
219 |
-
for i, future in enumerate(futures): # wait and get
|
220 |
-
return_string_collect.append( f"【{str(models[i])} 说】: <font color=\"{colors[i]}\"> {future.result()} </font>" )
|
221 |
-
|
222 |
-
window_mutex[-1] = False # stop mutex thread
|
223 |
-
res = '<br/><br/>\n\n---\n\n'.join(return_string_collect)
|
224 |
-
return res
|
225 |
-
|
226 |
-
|
227 |
-
def predict(inputs, llm_kwargs, *args, **kwargs):
|
228 |
-
"""
|
229 |
-
发送至LLM,流式获取输出。
|
230 |
-
用于基础的对话功能。
|
231 |
-
inputs 是本次问询的输入
|
232 |
-
top_p, temperature是LLM的内部调优参数
|
233 |
-
history 是之前的对话列表(注意无论是inputs还是history,内容太长了都会触发token数量溢出的错误)
|
234 |
-
chatbot 为WebUI中显示的对话列表,修改它,然后yeild出去,可以直接修改对话界面内容
|
235 |
-
additional_fn代表点击的哪个按钮,按钮见functional.py
|
236 |
-
"""
|
237 |
-
|
238 |
-
method = model_info[llm_kwargs['llm_model']]["fn_with_ui"]
|
239 |
-
yield from method(inputs, llm_kwargs, *args, **kwargs)
|
240 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Cyril666/ContourNet-ABI/maskrcnn_benchmark/data/datasets/evaluation/word/util/mask.py
DELETED
@@ -1,82 +0,0 @@
|
|
1 |
-
import cv2
|
2 |
-
import numpy as np
|
3 |
-
|
4 |
-
import util
|
5 |
-
from util import nb as neighbour
|
6 |
-
|
7 |
-
|
8 |
-
def find_white_components(mask, min_area = 0):
|
9 |
-
mask = (mask == 0) * 1
|
10 |
-
return find_black_components(mask, min_area);
|
11 |
-
|
12 |
-
def find_black_components(mask, min_area = 0):
|
13 |
-
"""
|
14 |
-
find components of zeros.
|
15 |
-
mask is a 0-1 matrix, ndarray.
|
16 |
-
"""
|
17 |
-
neighbour_type = neighbour.N4
|
18 |
-
visited = mask.copy()
|
19 |
-
c_mask = util.img.black(mask)
|
20 |
-
|
21 |
-
root_idx = [1]
|
22 |
-
def get_new_root():
|
23 |
-
root_idx[0] += 1
|
24 |
-
return root_idx[0]
|
25 |
-
|
26 |
-
def is_visited(xy):
|
27 |
-
x, y = xy
|
28 |
-
return visited[y][x]
|
29 |
-
|
30 |
-
def set_visited(xy):
|
31 |
-
x, y = xy
|
32 |
-
visited[y][x] = 255
|
33 |
-
|
34 |
-
def set_root(xy, root):
|
35 |
-
x, y = xy
|
36 |
-
c_mask[y][x] = root
|
37 |
-
|
38 |
-
def get_root(xy):
|
39 |
-
x, y = xy
|
40 |
-
return c_mask[y][x]
|
41 |
-
|
42 |
-
rows, cols = np.shape(mask)
|
43 |
-
q = []
|
44 |
-
for y in xrange(rows):
|
45 |
-
for x in xrange(cols):
|
46 |
-
xy = (x, y)
|
47 |
-
if is_visited(xy):
|
48 |
-
continue
|
49 |
-
|
50 |
-
q.append(xy)
|
51 |
-
new_root = get_new_root()
|
52 |
-
while len(q) > 0:
|
53 |
-
cp = q.pop()
|
54 |
-
set_root(cp, new_root)
|
55 |
-
set_visited(cp)
|
56 |
-
nbs = neighbour.get_neighbours(cp[0], cp[1], cols, rows, neighbour_type)
|
57 |
-
for nb in nbs:
|
58 |
-
if not is_visited(nb) and nb not in q:
|
59 |
-
# q.append(nb)
|
60 |
-
q.insert(0, nb)
|
61 |
-
|
62 |
-
components = {}
|
63 |
-
for y in xrange(rows):
|
64 |
-
for x in xrange(cols):
|
65 |
-
root = get_root((x, y))
|
66 |
-
if root == 0:
|
67 |
-
continue
|
68 |
-
|
69 |
-
if root not in components:
|
70 |
-
components[root] = []
|
71 |
-
|
72 |
-
components[root].append((x,y))
|
73 |
-
|
74 |
-
ret = []
|
75 |
-
|
76 |
-
for root in components:
|
77 |
-
if len(components[root]) >= min_area:
|
78 |
-
ret.append(components[root])
|
79 |
-
|
80 |
-
return ret
|
81 |
-
|
82 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/DAMO-NLP-SG/Video-LLaMA/video_llama/tasks/image_text_pretrain.py
DELETED
@@ -1,18 +0,0 @@
|
|
1 |
-
"""
|
2 |
-
Copyright (c) 2022, salesforce.com, inc.
|
3 |
-
All rights reserved.
|
4 |
-
SPDX-License-Identifier: BSD-3-Clause
|
5 |
-
For full license text, see the LICENSE_Lavis file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
6 |
-
"""
|
7 |
-
|
8 |
-
from video_llama.common.registry import registry
|
9 |
-
from video_llama.tasks.base_task import BaseTask
|
10 |
-
|
11 |
-
|
12 |
-
@registry.register_task("image_text_pretrain")
|
13 |
-
class ImageTextPretrainTask(BaseTask):
|
14 |
-
def __init__(self):
|
15 |
-
super().__init__()
|
16 |
-
|
17 |
-
def evaluation(self, model, data_loader, cuda_enabled=True):
|
18 |
-
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/gradio/chat_interface.py
DELETED
@@ -1,355 +0,0 @@
|
|
1 |
-
"""
|
2 |
-
This file defines a useful high-level abstraction to build Gradio chatbots: ChatInterface.
|
3 |
-
"""
|
4 |
-
|
5 |
-
|
6 |
-
from __future__ import annotations
|
7 |
-
|
8 |
-
import inspect
|
9 |
-
import warnings
|
10 |
-
from typing import Callable, Generator
|
11 |
-
|
12 |
-
from gradio_client.documentation import document, set_documentation_group
|
13 |
-
|
14 |
-
from gradio.blocks import Blocks
|
15 |
-
from gradio.components import (
|
16 |
-
Button,
|
17 |
-
Chatbot,
|
18 |
-
Markdown,
|
19 |
-
State,
|
20 |
-
Textbox,
|
21 |
-
)
|
22 |
-
from gradio.helpers import create_examples as Examples # noqa: N812
|
23 |
-
from gradio.layouts import Group, Row
|
24 |
-
from gradio.themes import ThemeClass as Theme
|
25 |
-
|
26 |
-
set_documentation_group("chatinterface")
|
27 |
-
|
28 |
-
|
29 |
-
@document()
|
30 |
-
class ChatInterface(Blocks):
|
31 |
-
"""
|
32 |
-
ChatInterface is Gradio's high-level abstraction for creating chatbot UIs, and allows you to create
|
33 |
-
a web-based demo around a chatbot model in a few lines of code. Only one parameter is required: fn, which
|
34 |
-
takes a function that governs the response of the chatbot based on the user input and chat history. Additional
|
35 |
-
parameters can be used to control the appearance and behavior of the demo.
|
36 |
-
|
37 |
-
Example:
|
38 |
-
import gradio as gr
|
39 |
-
|
40 |
-
def echo(message, history):
|
41 |
-
return message
|
42 |
-
|
43 |
-
demo = gr.ChatInterface(fn=echo, examples=["hello", "hola", "merhaba"], title="Echo Bot")
|
44 |
-
demo.launch()
|
45 |
-
Demos: chatinterface_random_response, chatinterface_streaming_echo
|
46 |
-
Guides: creating-a-chatbot-fast, sharing-your-app
|
47 |
-
"""
|
48 |
-
|
49 |
-
def __init__(
|
50 |
-
self,
|
51 |
-
fn: Callable,
|
52 |
-
*,
|
53 |
-
chatbot: Chatbot | None = None,
|
54 |
-
textbox: Textbox | None = None,
|
55 |
-
examples: list[str] | None = None,
|
56 |
-
cache_examples: bool | None = None,
|
57 |
-
title: str | None = None,
|
58 |
-
description: str | None = None,
|
59 |
-
theme: Theme | str | None = None,
|
60 |
-
css: str | None = None,
|
61 |
-
analytics_enabled: bool | None = None,
|
62 |
-
submit_btn: str | None | Button = "Submit",
|
63 |
-
retry_btn: str | None | Button = "🔄 Retry",
|
64 |
-
undo_btn: str | None | Button = "↩️ Undo",
|
65 |
-
clear_btn: str | None | Button = "🗑️ Clear",
|
66 |
-
):
|
67 |
-
"""
|
68 |
-
Parameters:
|
69 |
-
fn: the function to wrap the chat interface around. Should accept two parameters: a string input message and list of two-element lists of the form [[user_message, bot_message], ...] representing the chat history, and return a string response. See the Chatbot documentation for more information on the chat history format.
|
70 |
-
chatbot: an instance of the gr.Chatbot component to use for the chat interface, if you would like to customize the chatbot properties. If not provided, a default gr.Chatbot component will be created.
|
71 |
-
textbox: an instance of the gr.Textbox component to use for the chat interface, if you would like to customize the textbox properties. If not provided, a default gr.Textbox component will be created.
|
72 |
-
examples: sample inputs for the function; if provided, appear below the chatbot and can be clicked to populate the chatbot input.
|
73 |
-
cache_examples: If True, caches examples in the server for fast runtime in examples. The default option in HuggingFace Spaces is True. The default option elsewhere is False.
|
74 |
-
title: a title for the interface; if provided, appears above chatbot in large font. Also used as the tab title when opened in a browser window.
|
75 |
-
description: a description for the interface; if provided, appears above the chatbot and beneath the title in regular font. Accepts Markdown and HTML content.
|
76 |
-
theme: Theme to use, loaded from gradio.themes.
|
77 |
-
css: custom css or path to custom css file to use with interface.
|
78 |
-
analytics_enabled: Whether to allow basic telemetry. If None, will use GRADIO_ANALYTICS_ENABLED environment variable if defined, or default to True.
|
79 |
-
submit_btn: Text to display on the submit button. If None, no button will be displayed. If a Button object, that button will be used.
|
80 |
-
retry_btn: Text to display on the retry button. If None, no button will be displayed. If a Button object, that button will be used.
|
81 |
-
undo_btn: Text to display on the delete last button. If None, no button will be displayed. If a Button object, that button will be used.
|
82 |
-
clear_btn: Text to display on the clear button. If None, no button will be displayed. If a Button object, that button will be used.
|
83 |
-
"""
|
84 |
-
super().__init__(
|
85 |
-
analytics_enabled=analytics_enabled,
|
86 |
-
mode="chat_interface",
|
87 |
-
css=css,
|
88 |
-
title=title or "Gradio",
|
89 |
-
theme=theme,
|
90 |
-
)
|
91 |
-
if len(inspect.signature(fn).parameters) != 2:
|
92 |
-
warnings.warn(
|
93 |
-
"The function to ChatInterface should take two inputs (message, history) and return a single string response.",
|
94 |
-
UserWarning,
|
95 |
-
)
|
96 |
-
|
97 |
-
self.fn = fn
|
98 |
-
self.examples = examples
|
99 |
-
if self.space_id and cache_examples is None:
|
100 |
-
self.cache_examples = True
|
101 |
-
else:
|
102 |
-
self.cache_examples = cache_examples or False
|
103 |
-
self.buttons: list[Button] = []
|
104 |
-
|
105 |
-
with self:
|
106 |
-
if title:
|
107 |
-
Markdown(
|
108 |
-
f"<h1 style='text-align: center; margin-bottom: 1rem'>{self.title}</h1>"
|
109 |
-
)
|
110 |
-
if description:
|
111 |
-
Markdown(description)
|
112 |
-
|
113 |
-
with Group():
|
114 |
-
if chatbot:
|
115 |
-
self.chatbot = chatbot.render()
|
116 |
-
else:
|
117 |
-
self.chatbot = Chatbot(label="Chatbot")
|
118 |
-
with Row():
|
119 |
-
if textbox:
|
120 |
-
self.textbox = textbox.render()
|
121 |
-
else:
|
122 |
-
self.textbox = Textbox(
|
123 |
-
container=False,
|
124 |
-
show_label=False,
|
125 |
-
placeholder="Type a message...",
|
126 |
-
scale=10,
|
127 |
-
)
|
128 |
-
if submit_btn:
|
129 |
-
if isinstance(submit_btn, Button):
|
130 |
-
submit_btn.render()
|
131 |
-
elif isinstance(submit_btn, str):
|
132 |
-
submit_btn = Button(
|
133 |
-
submit_btn, variant="primary", scale=1, min_width=0
|
134 |
-
)
|
135 |
-
else:
|
136 |
-
raise ValueError(
|
137 |
-
f"The submit_btn parameter must be a gr.Button, string, or None, not {type(submit_btn)}"
|
138 |
-
)
|
139 |
-
self.buttons.append(submit_btn)
|
140 |
-
|
141 |
-
with Row():
|
142 |
-
self.stop_btn = Button("Stop", variant="stop", visible=False)
|
143 |
-
|
144 |
-
for btn in [retry_btn, undo_btn, clear_btn]:
|
145 |
-
if btn:
|
146 |
-
if isinstance(btn, Button):
|
147 |
-
btn.render()
|
148 |
-
elif isinstance(btn, str):
|
149 |
-
btn = Button(btn, variant="secondary")
|
150 |
-
else:
|
151 |
-
raise ValueError(
|
152 |
-
f"All the _btn parameters must be a gr.Button, string, or None, not {type(btn)}"
|
153 |
-
)
|
154 |
-
self.buttons.append(btn)
|
155 |
-
|
156 |
-
self.fake_api_btn = Button("Fake API", visible=False)
|
157 |
-
self.fake_response_textbox = Textbox(label="Response", visible=False)
|
158 |
-
(
|
159 |
-
self.submit_btn,
|
160 |
-
self.retry_btn,
|
161 |
-
self.undo_btn,
|
162 |
-
self.clear_btn,
|
163 |
-
) = self.buttons
|
164 |
-
|
165 |
-
if examples:
|
166 |
-
if inspect.isgeneratorfunction(self.fn):
|
167 |
-
examples_fn = self._examples_stream_fn
|
168 |
-
else:
|
169 |
-
examples_fn = self._examples_fn
|
170 |
-
|
171 |
-
self.examples_handler = Examples(
|
172 |
-
examples=examples,
|
173 |
-
inputs=self.textbox,
|
174 |
-
outputs=self.chatbot,
|
175 |
-
fn=examples_fn,
|
176 |
-
cache_examples=self.cache_examples,
|
177 |
-
)
|
178 |
-
|
179 |
-
self.saved_input = State()
|
180 |
-
|
181 |
-
self._setup_events()
|
182 |
-
self._setup_api()
|
183 |
-
|
184 |
-
def _setup_events(self):
|
185 |
-
if inspect.isgeneratorfunction(self.fn):
|
186 |
-
submit_fn = self._stream_fn
|
187 |
-
else:
|
188 |
-
submit_fn = self._submit_fn
|
189 |
-
|
190 |
-
self.textbox.submit(
|
191 |
-
self._clear_and_save_textbox,
|
192 |
-
[self.textbox],
|
193 |
-
[self.textbox, self.saved_input],
|
194 |
-
api_name=False,
|
195 |
-
queue=False,
|
196 |
-
).then(
|
197 |
-
self._display_input,
|
198 |
-
[self.saved_input, self.chatbot],
|
199 |
-
[self.chatbot],
|
200 |
-
api_name=False,
|
201 |
-
queue=False,
|
202 |
-
).then(
|
203 |
-
submit_fn,
|
204 |
-
[self.saved_input, self.chatbot],
|
205 |
-
[self.chatbot],
|
206 |
-
api_name=False,
|
207 |
-
)
|
208 |
-
|
209 |
-
if self.submit_btn:
|
210 |
-
self.submit_btn.click(
|
211 |
-
self._clear_and_save_textbox,
|
212 |
-
[self.textbox],
|
213 |
-
[self.textbox, self.saved_input],
|
214 |
-
api_name=False,
|
215 |
-
queue=False,
|
216 |
-
).then(
|
217 |
-
self._display_input,
|
218 |
-
[self.saved_input, self.chatbot],
|
219 |
-
[self.chatbot],
|
220 |
-
api_name=False,
|
221 |
-
queue=False,
|
222 |
-
).then(
|
223 |
-
submit_fn,
|
224 |
-
[self.saved_input, self.chatbot],
|
225 |
-
[self.chatbot],
|
226 |
-
api_name=False,
|
227 |
-
)
|
228 |
-
|
229 |
-
if self.retry_btn:
|
230 |
-
self.retry_btn.click(
|
231 |
-
self._delete_prev_fn,
|
232 |
-
[self.chatbot],
|
233 |
-
[self.chatbot, self.saved_input],
|
234 |
-
api_name=False,
|
235 |
-
queue=False,
|
236 |
-
).then(
|
237 |
-
self._display_input,
|
238 |
-
[self.saved_input, self.chatbot],
|
239 |
-
[self.chatbot],
|
240 |
-
api_name=False,
|
241 |
-
queue=False,
|
242 |
-
).then(
|
243 |
-
submit_fn,
|
244 |
-
[self.saved_input, self.chatbot],
|
245 |
-
[self.chatbot],
|
246 |
-
api_name=False,
|
247 |
-
)
|
248 |
-
|
249 |
-
if self.undo_btn:
|
250 |
-
self.undo_btn.click(
|
251 |
-
self._delete_prev_fn,
|
252 |
-
[self.chatbot],
|
253 |
-
[self.chatbot, self.saved_input],
|
254 |
-
api_name=False,
|
255 |
-
queue=False,
|
256 |
-
).then(
|
257 |
-
lambda x: x,
|
258 |
-
[self.saved_input],
|
259 |
-
[self.textbox],
|
260 |
-
api_name=False,
|
261 |
-
queue=False,
|
262 |
-
)
|
263 |
-
|
264 |
-
if self.clear_btn:
|
265 |
-
self.clear_btn.click(
|
266 |
-
lambda: ([], None),
|
267 |
-
None,
|
268 |
-
[self.chatbot, self.saved_input],
|
269 |
-
queue=False,
|
270 |
-
api_name=False,
|
271 |
-
)
|
272 |
-
|
273 |
-
def _setup_api(self):
|
274 |
-
if inspect.isgeneratorfunction(self.fn):
|
275 |
-
api_fn = self._api_stream_fn
|
276 |
-
else:
|
277 |
-
api_fn = self._api_submit_fn
|
278 |
-
|
279 |
-
# Use a gr.State() instead of self.chatbot so that the API doesn't require passing forth
|
280 |
-
# a chat history, instead it is just stored internally in the state.
|
281 |
-
history = State([])
|
282 |
-
|
283 |
-
self.fake_api_btn.click(
|
284 |
-
api_fn,
|
285 |
-
[self.textbox, history],
|
286 |
-
[self.textbox, history],
|
287 |
-
api_name="chat",
|
288 |
-
)
|
289 |
-
|
290 |
-
def _clear_and_save_textbox(self, message: str) -> tuple[str, str]:
|
291 |
-
return "", message
|
292 |
-
|
293 |
-
def _display_input(
|
294 |
-
self, message: str, history: list[list[str | None]]
|
295 |
-
) -> list[list[str | None]]:
|
296 |
-
history.append([message, None])
|
297 |
-
return history
|
298 |
-
|
299 |
-
def _submit_fn(
|
300 |
-
self, message: str, history_with_input: list[list[str | None]]
|
301 |
-
) -> list[list[str | None]]:
|
302 |
-
history = history_with_input[:-1]
|
303 |
-
response = self.fn(message, history)
|
304 |
-
history.append([message, response])
|
305 |
-
return history
|
306 |
-
|
307 |
-
def _stream_fn(
|
308 |
-
self, message: str, history_with_input: list[list[str | None]]
|
309 |
-
) -> Generator[list[list[str | None]], None, None]:
|
310 |
-
history = history_with_input[:-1]
|
311 |
-
generator = self.fn(message, history)
|
312 |
-
try:
|
313 |
-
first_response = next(generator)
|
314 |
-
yield history + [[message, first_response]]
|
315 |
-
except StopIteration:
|
316 |
-
yield history + [[message, None]]
|
317 |
-
for response in generator:
|
318 |
-
yield history + [[message, response]]
|
319 |
-
|
320 |
-
def _api_submit_fn(
|
321 |
-
self, message: str, history: list[list[str | None]]
|
322 |
-
) -> tuple[str, list[list[str | None]]]:
|
323 |
-
response = self.fn(message, history)
|
324 |
-
history.append([message, response])
|
325 |
-
return response, history
|
326 |
-
|
327 |
-
def _api_stream_fn(
|
328 |
-
self, message: str, history: list[list[str | None]]
|
329 |
-
) -> Generator[tuple[str | None, list[list[str | None]]], None, None]:
|
330 |
-
generator = self.fn(message, history)
|
331 |
-
try:
|
332 |
-
first_response = next(generator)
|
333 |
-
yield first_response, history + [[message, first_response]]
|
334 |
-
except StopIteration:
|
335 |
-
yield None, history + [[message, None]]
|
336 |
-
for response in generator:
|
337 |
-
yield response, history + [[message, response]]
|
338 |
-
|
339 |
-
def _examples_fn(self, message: str) -> list[list[str | None]]:
|
340 |
-
return [[message, self.fn(message, [])]]
|
341 |
-
|
342 |
-
def _examples_stream_fn(
|
343 |
-
self, message: str
|
344 |
-
) -> Generator[list[list[str | None]], None, None]:
|
345 |
-
for response in self.fn(message, []):
|
346 |
-
yield [[message, response]]
|
347 |
-
|
348 |
-
def _delete_prev_fn(
|
349 |
-
self, history: list[list[str | None]]
|
350 |
-
) -> tuple[list[list[str | None]], str]:
|
351 |
-
try:
|
352 |
-
message, _ = history.pop()
|
353 |
-
except IndexError:
|
354 |
-
message = ""
|
355 |
-
return history, message or ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/gradio/cli.py
DELETED
@@ -1,14 +0,0 @@
|
|
1 |
-
import sys
|
2 |
-
|
3 |
-
import gradio.deploy_space
|
4 |
-
import gradio.reload
|
5 |
-
|
6 |
-
|
7 |
-
def cli():
|
8 |
-
args = sys.argv[1:]
|
9 |
-
if len(args) == 0:
|
10 |
-
raise ValueError("No file specified.")
|
11 |
-
if args[0] == "deploy":
|
12 |
-
gradio.deploy_space.deploy()
|
13 |
-
else:
|
14 |
-
gradio.reload.main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|