Commit
·
517485f
1
Parent(s):
99fd9ea
Update parquet files (step 109 of 249)
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- spaces/1acneusushi/gradio-2dmoleculeeditor/data/4rabet App for PC How to Get It and Why You Need It.md +0 -27
- spaces/1acneusushi/gradio-2dmoleculeeditor/data/Crack AutoCAD Mechanical 2018 Crack LINK.md +0 -131
- spaces/1acneusushi/gradio-2dmoleculeeditor/data/Download Imyfone Ibypasser Cracked.md +0 -18
- spaces/1acneusushi/gradio-2dmoleculeeditor/data/Download Save Game Marvel Ultimate Alliance 2 Pc All Character Unlock With BEST Full Level.md +0 -39
- spaces/1acneusushi/gradio-2dmoleculeeditor/data/Edius 7 Crack File Download How to Save Money and Ruin Your Computer.md +0 -23
- spaces/1line/AutoGPT/autogpt/chat.py +0 -175
- spaces/1line/AutoGPT/tests/unit/test_browse_scrape_links.py +0 -118
- spaces/1pelhydcardo/ChatGPT-prompt-generator/assets/Arceus X How to Run PC Scripts on Your iOS or Android Phone.md +0 -145
- spaces/1phancelerku/anime-remove-background/Download Blockman Go v2.40.1 APK with Unlimited Money and Gems.md +0 -120
- spaces/1phancelerku/anime-remove-background/Enjoy Messenger on Your Desktop with the Official Windows App.md +0 -183
- spaces/44ov41za8i/FreeVC/speaker_encoder/audio.py +0 -107
- spaces/A666sxr/Genshin_TTS/text/mandarin.py +0 -328
- spaces/AI-Dashboards/HEDIS.Assessment.PHQ9.GADD7.SDoH/README.md +0 -10
- spaces/AIWaves/Debate/src/agents/Agent/__init__.py +0 -1
- spaces/AIZero2HeroBootcamp/3DHuman/app.py +0 -27
- spaces/AIatUIUC/CodeLATS/lats/lats_main.py +0 -78
- spaces/AchyuthGamer/OpenGPT/g4f/Provider/deprecated/AiService.py +0 -36
- spaces/AgentVerse/agentVerse/ui/src/phaser3-rex-plugins/templates/ui/circularprogress/Factory.d.ts +0 -13
- spaces/AgentVerse/agentVerse/ui/src/phaser3-rex-plugins/templates/ui/dialog/Dialog.js +0 -306
- spaces/Ahmedmewloud/Depplearnig/Makefile +0 -28
- spaces/AiPalsDev/Translate_It/README.md +0 -13
- spaces/Ajaymaurya1008/meme-identifier/README.md +0 -12
- spaces/Alpaca233/SadTalker/src/face3d/options/inference_options.py +0 -23
- spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/examples/research_projects/README.md +0 -14
- spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/scripts/conversion_ldm_uncond.py +0 -56
- spaces/Andy1621/uniformer_image_detection/configs/res2net/cascade_mask_rcnn_r2_101_fpn_20e_coco.py +0 -4
- spaces/Andy1621/uniformer_image_detection/configs/tridentnet/tridentnet_r50_caffe_1x_coco.py +0 -53
- spaces/Andy1621/uniformer_image_segmentation/README.md +0 -13
- spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/pip/_internal/utils/egg_link.py +0 -72
- spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/pip/_vendor/rich/_null_file.py +0 -69
- spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/setuptools/command/build_ext.py +0 -383
- spaces/Awiny/Image2Paragraph/models/grit_src/third_party/CenterNet2/configs/common/optim.py +0 -15
- spaces/Benson/text-generation/Examples/Captulo 5 Matemticas Clase 12 Pdf.md +0 -183
- spaces/Big-Web/MMSD/env/Lib/site-packages/botocore/auth.py +0 -990
- spaces/Big-Web/MMSD/env/Lib/site-packages/pip/_vendor/rich/palette.py +0 -100
- spaces/Bostoncake/ChatAssistant/README.md +0 -13
- spaces/CVPR/Dual-Key_Backdoor_Attacks/datagen/detectron2/detectron2/export/caffe2_export.py +0 -204
- spaces/CVPR/LIVE/pybind11/tests/test_stl.py +0 -252
- spaces/CVPR/LIVE/thrust/thrust/detail/functional/placeholder.h +0 -39
- spaces/CVPR/LIVE/thrust/thrust/scatter.h +0 -423
- spaces/CVPR/LIVE/thrust/thrust/system/detail/generic/advance.h +0 -41
- spaces/Cpp4App/Cpp4App/CDM/detect_text/text_detection.py +0 -289
- spaces/DHEIVER/Segmento_de_Angio_Coronariana_v5/preprocess.py +0 -13
- spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/fontTools/varLib/stat.py +0 -142
- spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/httpcore/_async/connection_pool.py +0 -356
- spaces/DaFujaTyping/hf-Chat-ui/PRIVACY.md +0 -35
- spaces/Dantra1/CeliaSensei/mel_processing.py +0 -101
- spaces/DragGan/DragGan-Inversion/torch_utils/ops/upfirdn2d.cpp +0 -107
- spaces/EronSamez/RVC_HFmeu/lib/globals/globals.py +0 -5
- spaces/EsoCode/text-generation-webui/css/main.js +0 -18
spaces/1acneusushi/gradio-2dmoleculeeditor/data/4rabet App for PC How to Get It and Why You Need It.md
DELETED
@@ -1,27 +0,0 @@
|
|
1 |
-
<br />
|
2 |
-
<h1>How to Download 4rabet App for PC and Enjoy Online Betting and Casino</h1>
|
3 |
-
<p>4rabet is a popular online platform that offers sports betting and casino games for Indian players. It has a user-friendly interface, a wide range of markets and events, attractive bonuses and promotions, and convenient payment methods. However, if you want to enjoy 4rabet on your PC, you may face some difficulties. The official website does not have a separate app for PC, but only for Android and iOS devices. So, how can you download 4rabet app for PC and access all its features?</p>
|
4 |
-
<h2>4rabet app download for pc</h2><br /><p><b><b>DOWNLOAD</b> ✯ <a href="https://byltly.com/2uKv3C">https://byltly.com/2uKv3C</a></b></p><br /><br />
|
5 |
-
<p>In this article, we will show you how to download 4rabet app for PC using an emulator software that allows you to run mobile apps on your computer. We will also explain why you should use 4rabet app for PC instead of the website version and what benefits you can get from it.</p>
|
6 |
-
<h2>Why Use 4rabet App for PC?</h2>
|
7 |
-
<p>Using 4rabet app for PC has several advantages over using the website version. Here are some of them:</p>
|
8 |
-
<ul>
|
9 |
-
<li>You can get the latest version of 4rabet app faster than waiting for the website update. The developers of 4rabet often post new versions of the app on their website or Github, which are then shared by users on Reddit. These versions may have new features, bug fixes, or performance improvements that are not yet available on the website.</li>
|
10 |
-
<li>You can get feedback and advice from other users who have tried the same version of 4rabet app. You can read their comments, reviews, suggestions, and warnings about the download link and the app itself. You can also ask questions or report problems if you encounter any issues with the download or the installation.</li>
|
11 |
-
<li>You can get access to additional plugins or extensions that enhance the functionality of 4rabet app. For example, you can download a plugin that enables QuickSync support for faster encoding on Intel CPUs. You can also download a mod that improves the graphics of Need for Speed: Underground 2 using 4rabet app.</li>
|
12 |
-
<li>You can enjoy a better user experience and performance on your PC. The app is designed to run smoothly and efficiently on mobile devices, so it will work even better on your PC. You can also adjust the settings and preferences of the app according to your needs and preferences.</li>
|
13 |
-
</ul>
|
14 |
-
<h2>How to Download 4rabet App for PC?</h2>
|
15 |
-
<p>Downloading 4rabet app for PC is easy and straightforward. Here are the steps to follow:</p>
|
16 |
-
<p></p>
|
17 |
-
<ol>
|
18 |
-
<li>Go to <a href="https://www.reddit.com/r/4raBet/">r/4raBet</a> and browse through the posts. Look for posts that have a download link or a Github link in the title or the content.</li>
|
19 |
-
<li>Click on the link and check the source. Make sure it is from a reputable website or a verified developer. Avoid links that are from unknown or suspicious sources.</li>
|
20 |
-
<li>Download the file and scan it with your antivirus program before opening it. Make sure it is free of malware or viruses.</li>
|
21 |
-
<li>Install or run the file according to the instructions provided by the developer or the user who posted the link.</li>
|
22 |
-
<li>Enjoy using 4rabet app on your PC!</li>
|
23 |
-
</ol>
|
24 |
-
<h3>Conclusion</h3>
|
25 |
-
<p>In this article, we have shown you how to download 4rabet app for PC and why you should use it instead of the website version. Downloading 4rabet app for PC can give you access to the latest version of the app, feedback and advice from other users, additional plugins or extensions that enhance its functionality, and a better user experience and performance on your PC. However, you should always be careful and cautious when downloading anything from the internet. Make sure you check the source, scan the file, and follow the instructions properly.</p> ddb901b051<br />
|
26 |
-
<br />
|
27 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1acneusushi/gradio-2dmoleculeeditor/data/Crack AutoCAD Mechanical 2018 Crack LINK.md
DELETED
@@ -1,131 +0,0 @@
|
|
1 |
-
<br />
|
2 |
-
<h1>How to Crack AutoCAD Mechanical 2018</h1>
|
3 |
-
<p>If you are a mechanical engineer or a designer who needs a powerful and versatile software for creating and editing mechanical drawings, you might have heard of AutoCAD Mechanical 2018. This is one of the most popular and widely used applications in the field of mechanical design and engineering. But what if you don't have enough money to buy a license for this software? Is there a way to use it for free without compromising its quality and functionality? The answer is yes, you can crack AutoCAD Mechanical 2018 and enjoy its full features without paying a dime. In this article, we will show you how to do that in a few simple steps. But before we get into that, let's first understand what AutoCAD Mechanical 2018 is and why you might want to crack it.</p>
|
4 |
-
<h2>crack AutoCAD Mechanical 2018 crack</h2><br /><p><b><b>Download File</b> ✶ <a href="https://byltly.com/2uKvzx">https://byltly.com/2uKvzx</a></b></p><br /><br />
|
5 |
-
<h2>What is AutoCAD Mechanical 2018?</h2>
|
6 |
-
<p>AutoCAD Mechanical 2018 is a software that is designed specifically for mechanical engineering and design. It is part of the Autodesk family of products, which are known for their high-quality and innovative solutions for various industries. AutoCAD Mechanical 2018 includes all the features and functions of AutoCAD, plus a comprehensive library of standards-based parts and tools for automating common mechanical drawing tasks. With AutoCAD Mechanical 2018, you can:</p>
|
7 |
-
<ul>
|
8 |
-
<li>Create accurate and detailed mechanical drawings with ease.</li>
|
9 |
-
<li>Use predefined parts from various standards, such as ANSI, ISO, DIN, JIS, etc.</li>
|
10 |
-
<li>Generate bills of materials (BOMs) and annotations automatically.</li>
|
11 |
-
<li>Edit and modify parts and drawings with intuitive commands and tools.</li>
|
12 |
-
<li>Collaborate and share your work with other engineers and designers using cloud services.</li>
|
13 |
-
<li>Integrate your work with other Autodesk products, such as Inventor, Fusion 360, etc.</li>
|
14 |
-
</ul>
|
15 |
-
<p>AutoCAD Mechanical 2018 is compatible with Windows 7, Windows 8.1, and Windows 10 operating systems. It also supports both 32-bit and 64-bit architectures.</p>
|
16 |
-
<h3>Features and benefits of AutoCAD Mechanical 2018</h3>
|
17 |
-
<p>Some of the main features and benefits of AutoCAD Mechanical 2018 are:</p>
|
18 |
-
<ul>
|
19 |
-
<li>It has a user-friendly interface that is similar to AutoCAD, so you can easily switch between them.</li>
|
20 |
-
<li>It has a powerful drawing engine that can handle complex geometries and large assemblies.</li>
|
21 |
-
<li>It has a smart dimensioning system that can automatically create accurate dimensions based on your drawing context.</li>
|
22 |
-
<li>It has a layer management system that can help you organize your drawings and control their visibility.</li>
|
23 |
-
<li>It has a content browser that can help you find and insert parts from various sources, such as local files, online libraries, etc.</li>
|
24 |
-
<li>It has a design calculation tool that can help you perform various calculations related to mechanical design, such as force, torque, stress, etc.</li>
|
25 |
-
<li>It has a documentation tool that can help you create professional-looking reports and presentations with your drawings.</li>
|
26 |
-
<li>It has a customization tool that can help you tailor the software to your specific needs and preferences.</li>
|
27 |
-
</ul>
|
28 |
-
<h3>System requirements for AutoCAD Mechanical 2018</h3>
|
29 |
-
<p>The minimum system requirements for running AutoCAD Mechanical 2018 are:</p>
|
30 |
-
<table>
|
31 |
-
<tr><td>Processor</td><td>1 GHz or faster</td></tr>
|
32 |
-
<tr><td>Memory</td><td>4 GB (32-bit) or 8 GB (64-bit)</td></tr>
|
33 |
-
<tr><td>Disk space</td><td>6 GB</td></tr>
|
34 |
-
<tr><td>Display</td><td>1360 x 768 resolution with True Color</td></tr>
|
35 |
-
<tr><td>Graphics card</td><td>Windows display adapter capable of DirectX®9 or DirectX®11 compliant card recommended</td></tr>
|
36 |
-
<tr><td>Internet connection</td><td>Necessary for installation and activation</td></tr>
|
37 |
-
</table>
|
38 |
-
<h2>Why do you need to crack AutoCAD Mechanical 2018?</h2>
|
39 |
-
<p>If you are wondering why you need to crack AutoCAD Mechanical 2018, there are two main reasons: cost and convenience. Let's explain them in more detail.</p>
|
40 |
-
<h3>The advantages of cracking AutoCAD Mechanical 2018</h3>
|
41 |
-
<p>The first reason why you might want to crack AutoCAD Mechanical 2018 is cost. As you may know, this software is not cheap. According to the official website of Autodesk, the price of a single-user license for one year is $1,610. That means you have to pay this amount every year if you want to keep using the software. If you want to buy a perpetual license, which means you can use the software forever without paying annual fees, the price is even higher: $4,195. That's a lot of money for most people, especially if you are a student or a freelancer who doesn't have a stable income source. By cracking AutoCAD Mechanical 2018, you can save yourself from these expenses and use the software for free.</p>
|
42 |
-
<h3>The risks of cracking AutoCAD Mechanical 2018</h3>
|
43 |
-
<p>The second reason why you might want to crack AutoCAD Mechanical 2018 is convenience. As you may know, this software requires an internet connection for installation and activation. That means you have to connect your computer to the internet every time you want to install or activate the software. This can be inconvenient if you don't have access to a reliable internet connection or if you want to use the software offline. By cracking AutoCAD Mechanical 2018, you can bypass this requirement and use the software offline without any hassle.</p>
|
44 |
-
<p>However, before you decide to crack AutoCAD Mechanical 2018, you should also be aware of the risks involved. Cracking any software is illegal and unethical. You are violating the terms and conditions of Autodesk by doing so. You are also exposing your computer to potential viruses and malware that may come with the crack file. You are also losing access to some features and services that are only available for licensed users, such as updates, support, cloud storage, etc. You are also risking legal actions from Autodesk if they find out that you are using their software illegally. Therefore, we do not recommend or endorse cracking AutoCAD Mechanical 2018 or any other software. We are only providing this information for educational purposes only.</p>
|
45 |
-
<p>How to crack AutoCAD Mechanical 2018 for free<br />
|
46 |
-
AutoCAD Mechanical 2018 crack download link<br />
|
47 |
-
AutoCAD Mechanical 2018 activation code generator<br />
|
48 |
-
AutoCAD Mechanical 2018 license key crack<br />
|
49 |
-
AutoCAD Mechanical 2018 serial number crack<br />
|
50 |
-
AutoCAD Mechanical 2018 keygen crack<br />
|
51 |
-
AutoCAD Mechanical 2018 patch crack<br />
|
52 |
-
AutoCAD Mechanical 2018 full version crack<br />
|
53 |
-
AutoCAD Mechanical 2018 offline installer crack<br />
|
54 |
-
AutoCAD Mechanical 2018 xforce crack<br />
|
55 |
-
AutoCAD Mechanical 2018 torrent crack<br />
|
56 |
-
AutoCAD Mechanical 2018 direct download crack<br />
|
57 |
-
AutoCAD Mechanical 2018 portable crack<br />
|
58 |
-
AutoCAD Mechanical 2018 cracked by team os<br />
|
59 |
-
AutoCAD Mechanical 2018 cracked by cgpersia<br />
|
60 |
-
AutoCAD Mechanical 2018 cracked by core x<br />
|
61 |
-
AutoCAD Mechanical 2018 cracked by r2r<br />
|
62 |
-
AutoCAD Mechanical 2018 cracked by skidrow<br />
|
63 |
-
AutoCAD Mechanical 2018 cracked by codex<br />
|
64 |
-
AutoCAD Mechanical 2018 cracked by reloaded<br />
|
65 |
-
AutoCAD Mechanical 2018 cracked by plaza<br />
|
66 |
-
AutoCAD Mechanical 2018 cracked by hoodlum<br />
|
67 |
-
AutoCAD Mechanical 2018 cracked by razor1911<br />
|
68 |
-
AutoCAD Mechanical 2018 cracked by fitgirl<br />
|
69 |
-
AutoCAD Mechanical 2018 cracked by dodi<br />
|
70 |
-
AutoCAD Mechanical 2018 crack fix<br />
|
71 |
-
AutoCAD Mechanical 2018 crack only<br />
|
72 |
-
AutoCAD Mechanical 2018 crack reddit<br />
|
73 |
-
AutoCAD Mechanical 2018 crack youtube<br />
|
74 |
-
AutoCAD Mechanical 2018 crack forum<br />
|
75 |
-
AutoCAD Mechanical 2018 crack blogspot<br />
|
76 |
-
AutoCAD Mechanical 2018 crack quora<br />
|
77 |
-
AutoCAD Mechanical 2018 crack medium<br />
|
78 |
-
AutoCAD Mechanical 2018 crack github<br />
|
79 |
-
AutoCAD Mechanical 2018 crack stackoverflow<br />
|
80 |
-
AutoCAD Mechanical 2018 crack tutorial<br />
|
81 |
-
AutoCAD Mechanical 2018 crack guide<br />
|
82 |
-
AutoCAD Mechanical 2018 crack instructions<br />
|
83 |
-
AutoCAD Mechanical 2018 crack tips and tricks<br />
|
84 |
-
AutoCAD Mechanical 2018 crack review<br />
|
85 |
-
AutoCAD Mechanical 2018 crack comparison<br />
|
86 |
-
AutoCAD Mechanical 2018 crack alternatives<br />
|
87 |
-
AutoCAD Mechanical 2018 crack pros and cons<br />
|
88 |
-
AutoCAD Mechanical 2018 crack benefits and drawbacks<br />
|
89 |
-
AutoCAD Mechanical 2018 crack features and specifications<br />
|
90 |
-
AutoCAD Mechanical 2018 crack system requirements<br />
|
91 |
-
AutoCAD Mechanical 2018 crack installation steps<br />
|
92 |
-
AutoCAD Mechanical 2018 crack troubleshooting steps<br />
|
93 |
-
AutoCAD Mechanical 2018 crack support and helpdesk</p>
|
94 |
-
<h2>How to crack AutoCAD Mechanical 2018 step by step</h2>
|
95 |
-
<p>If you still want to proceed with cracking AutoCAD Mechanical 2018 despite the risks involved, here are the steps that you need to follow:</p>
|
96 |
-
<h3>Step 1: Download the software and the crack file</h3>
|
97 |
-
<p>The first step is to download the software and the crack file from reliable sources. You can find many websites that offer these files online, but be careful not to download any files that contain viruses or malware. One of the websites that we found that offers these files is <a href="https://iggtech.com/download-x-force-2018/">https://iggtech.com/download-x-force-2018/</a>. This website provides both the software installer (in ISO format) and the crack file (in ZIP format) for various Autodesk products, including AutoCAD Mechanical 2018. You can download these files by clicking on their respective links on this website.</p>
|
98 |
-
<h3>Step 2: Install the software and disable the internet connection</h3>
|
99 |
-
<p>The second step is to install the software on your computer. To do this, you need to mount or extract the ISO file that contains the software installer using an appropriate tool (such as WinRAR or Daemon Tools). Then run setup.exe file from within this folder. Follow the instructions on screen until you reach the product key page. On this page, you need to enter the product key for AutoCAD Mechanical 2018, which is 206J1. You can find the product key for other Autodesk products on the same website. After entering the product key, click Next and follow the rest of the instructions until the installation is complete. The next step is to disable your internet connection. This is important to prevent the software from contacting Autodesk servers and verifying your license. You can do this by unplugging your ethernet cable, turning off your Wi-Fi, or disabling your network adapter from the Control Panel. <h3>Step 3: Run the crack file and generate the product key</h3>
|
100 |
-
<p>The third step is to run the crack file that you downloaded in step 1. This file is called X-force 2018 and it is a keygen that can generate product keys for all Autodesk products. To run this file, you need to extract it from the ZIP archive using an appropriate tool (such as WinRAR or 7-Zip). Then right-click on it and choose Run as administrator. You should see a window like this:</p>
|
101 |
-
<code>
|
102 |
-
X-force 2018 window </code>
|
103 |
-
<p>On this window, you need to select AutoCAD Mechanical 2018 from the drop-down menu and click on Generate. This will create a product key that you will use to activate the software. Copy this product key and keep it somewhere safe.</p>
|
104 |
-
<h3>Step 4: Activate the software with the product key</h3>
|
105 |
-
<p>The fourth step is to activate the software with the product key that you generated in step 3. To do this, you need to launch AutoCAD Mechanical 2018 on your computer. You should see a window like this:</p>
|
106 |
-
<code>
|
107 |
-
AutoCAD Mechanical 2018 activation window </code>
|
108 |
-
<p>On this window, you need to click on Enter a Serial Number and then click on I Agree. You should see another window like this:</p>
|
109 |
-
<code>
|
110 |
-
AutoCAD Mechanical 2018 serial number window </code>
|
111 |
-
<p>On this window, you need to enter any serial number that consists of six groups of four digits each. For example, you can enter 666-69696969 or 111-11111111. Then you need to enter the product key that you copied in step 3. After entering these values, click Next and then click on Close.</p>
|
112 |
-
<h3>Step 5: Enjoy the full version of AutoCAD Mechanical 2018</h3>
|
113 |
-
<p>The final step is to enjoy the full version of AutoCAD Mechanical 2018 without any limitations or restrictions. You can now use all the features and functions of this software for your mechanical design and engineering projects. You can also update the software if there are any available updates from Autodesk.</p>
|
114 |
-
<h2>Conclusion</h2>
|
115 |
-
<p>In this article, we have shown you how to crack AutoCAD Mechanical 2018 and use it for free without paying any fees or subscriptions. We have also explained what AutoCAD Mechanical 2018 is and why you might want to crack it. However, we have also warned you about the risks and consequences of cracking any software, which are illegal and unethical. Therefore, we do not recommend or endorse cracking AutoCAD Mechanical 2018 or any other software. We are only providing this information for educational purposes only.</p>
|
116 |
-
<h2>FAQs</h2>
|
117 |
-
<ul>
|
118 |
-
<li><b>What is AutoCAD Mechanical 2018?</b><br>
|
119 |
-
AutoCAD Mechanical 2018 is a software that is designed specifically for mechanical engineering and design. It includes all the features and functions of AutoCAD, plus a comprehensive library of standards-based parts and tools for automating common mechanical drawing tasks.</li>
|
120 |
-
<li><b>Why do I need to crack AutoCAD Mechanical 2018?</b><br>
|
121 |
-
You might want to crack AutoCAD Mechanical 2018 if you don't have enough money to buy a license for this software or if you want to use it offline without an internet connection.</li>
|
122 |
-
<li><b>How do I crack AutoCAD Mechanical 2018?</b><br>
|
123 |
-
You can crack AutoCAD Mechanical 2018 by following these steps: download the software and the crack file, install the software and disable the internet connection, run the crack file and generate the product key, activate the software with the product key, and enjoy the full version of AutoCAD Mechanical 2018.</li>
|
124 |
-
<li><b>What are the risks of cracking AutoCAD Mechanical 2018?</b><br>
|
125 |
-
The risks of cracking AutoCAD Mechanical 2018 are: violating the terms and conditions of Autodesk, exposing your computer to viruses and malware, losing access to some features and services, and risking legal actions from Autodesk.</li>
|
126 |
-
<li><b>What are the alternatives to cracking AutoCAD Mechanical 2018?</b><br>
|
127 |
-
The alternatives to cracking AutoCAD Mechanical 2018 are: buying a license for this software from Autodesk or an authorized reseller, using a free trial version of this software for a limited time, using a free or open-source software that has similar features and functions.</li>
|
128 |
-
</ul>
|
129 |
-
</p> 0a6ba089eb<br />
|
130 |
-
<br />
|
131 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1acneusushi/gradio-2dmoleculeeditor/data/Download Imyfone Ibypasser Cracked.md
DELETED
@@ -1,18 +0,0 @@
|
|
1 |
-
|
2 |
-
<h1>How to Download and Use iMyFone iBypasser Cracked Version</h1>
|
3 |
-
<p>iMyFone iBypasser is a software that can help you bypass iCloud activation lock on your iPhone, iPad, or iPod touch. It can also remove screen lock, Apple ID, and MDM lock from your iOS devices. However, iMyFone iBypasser is not a free software, and you need to pay a fee to use it for one device.</p>
|
4 |
-
<h2>download imyfone ibypasser cracked</h2><br /><p><b><b>Download</b> ✓✓✓ <a href="https://byltly.com/2uKvrO">https://byltly.com/2uKvrO</a></b></p><br /><br />
|
5 |
-
<p>If you want to use iMyFone iBypasser for free, you might be tempted to download and use a cracked version of it from the internet. However, this is not a good idea, as cracked versions of iMyFone iBypasser can contain malware, viruses, or spyware that can harm your computer or your iOS devices. Moreover, cracked versions of iMyFone iBypasser can also have compatibility issues, bugs, or errors that can affect your bypassing process.</p>
|
6 |
-
<p>Therefore, the best way to use iMyFone iBypasser for free is to download and use the official trial version of it from the official website. The trial version of iMyFone iBypasser allows you to check if your device is supported and preview the bypassing result before you pay. After that, you can either buy a license or uninstall it from your computer.</p>
|
7 |
-
<p>Here are the steps to download and use the trial version of iMyFone iBypasser:</p>
|
8 |
-
<p></p>
|
9 |
-
<ol>
|
10 |
-
<li>Go to <a href="https://www.imyfone.com/bypass-activation-lock/">https://www.imyfone.com/bypass-activation-lock/</a> and click on the "Free Trial" button.</li>
|
11 |
-
<li>Save the file to your computer and run it to start the installation process.</li>
|
12 |
-
<li>Follow the instructions on the screen and complete the installation.</li>
|
13 |
-
<li>Launch iMyFone iBypasser and connect your iOS device to your computer with a USB cable.</li>
|
14 |
-
<li>Follow the steps on the software to check if your device is supported and preview the bypassing result.</li>
|
15 |
-
</ol>
|
16 |
-
<p>Note: Do not use any crack, patch, keygen, or serial number to activate iMyFone iBypasser, as they can damage your computer or your iOS devices. Always use the official version of iMyFone iBypasser from the official website.</p> ddb901b051<br />
|
17 |
-
<br />
|
18 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1acneusushi/gradio-2dmoleculeeditor/data/Download Save Game Marvel Ultimate Alliance 2 Pc All Character Unlock With BEST Full Level.md
DELETED
@@ -1,39 +0,0 @@
|
|
1 |
-
<br />
|
2 |
-
<h1>How to Download Save Game Marvel Ultimate Alliance 2 Pc All Character Unlock With Full Level</h1>
|
3 |
-
<p>If you are a fan of Marvel comics and video games, you might have played Marvel Ultimate Alliance 2, a role-playing game that lets you create your own team of superheroes and villains. But if you want to enjoy the game to the fullest, you might want to unlock all the characters and level them up to their maximum potential. That's where a save game file comes in handy.</p>
|
4 |
-
<p>A save game file is a data file that stores your progress and settings in a video game. By downloading and using a save game file, you can skip the tedious process of unlocking and leveling up characters, and jump right into the action. In this article, we will show you how to download save game Marvel Ultimate Alliance 2 pc all character unlock with full level, and how to use it on your computer.</p>
|
5 |
-
<h2>Download Save Game Marvel Ultimate Alliance 2 Pc All Character Unlock With Full Level</h2><br /><p><b><b>DOWNLOAD</b> ✯ <a href="https://byltly.com/2uKwhv">https://byltly.com/2uKwhv</a></b></p><br /><br />
|
6 |
-
<h2>Step 1: Download the Save Game File</h2>
|
7 |
-
<p>The first step is to find and download a save game file that suits your needs. There are many websites that offer save game files for various video games, but not all of them are reliable or safe. You should always scan any file you download with an antivirus software before opening it.</p>
|
8 |
-
<p>One of the websites that we recommend for downloading save game files is <a href="https://www.savegamefiles.com/pc/marvel-ultimate-alliance-2/">SaveGameFiles.com</a>. This website has a large collection of save game files for various platforms and games, including Marvel Ultimate Alliance 2. You can browse the files by category or search for them by name.</p>
|
9 |
-
<p>To download the save game file for Marvel Ultimate Alliance 2 pc all character unlock with full level, follow these steps:</p>
|
10 |
-
<ol>
|
11 |
-
<li>Go to <a href="https://www.savegamefiles.com/pc/marvel-ultimate-alliance-2/">https://www.savegamefiles.com/pc/marvel-ultimate-alliance-2/</a>.</li>
|
12 |
-
<li>Scroll down and find the file named "Marvel Ultimate Alliance 2 - All Characters Unlocked + Max Level".</li>
|
13 |
-
<li>Click on the "Download" button next to the file name.</li>
|
14 |
-
<li>Wait for the file to be downloaded to your computer. The file size is about 1 MB.</li>
|
15 |
-
<li>Extract the file from the zip archive using a program like WinRAR or 7-Zip.</li>
|
16 |
-
<li>You should see a folder named "Marvel Ultimate Alliance 2" with two subfolders named "Data" and "Save".</li>
|
17 |
-
</ol>
|
18 |
-
<h2>Step 2: Backup Your Original Save Game File</h2>
|
19 |
-
<p>Before you use the downloaded save game file, you should backup your original save game file in case something goes wrong or you want to revert to your previous progress. To backup your original save game file, follow these steps:</p>
|
20 |
-
<ol>
|
21 |
-
<li>Go to the folder where your Marvel Ultimate Alliance 2 game is installed on your computer. The default location is C:\Program Files (x86)\Activision\Marvel - Ultimate Alliance 2.</li>
|
22 |
-
<li>Find and open the folder named "Data".</li>
|
23 |
-
<li>Copy the folder named "Save" and paste it somewhere safe on your computer, such as your desktop or an external drive.</li>
|
24 |
-
<li>Rename the copied folder to something like "Save Backup" or "Original Save".</li>
|
25 |
-
</ol>
|
26 |
-
<h2>Step 3: Replace Your Original Save Game File with the Downloaded One</h2>
|
27 |
-
<p>Now that you have backed up your original save game file, you can replace it with the downloaded one. To do this, follow these steps:</p>
|
28 |
-
<ol>
|
29 |
-
<li>Go back to the folder where you extracted the downloaded save game file.</li>
|
30 |
-
<li>Copy the folder named "Marvel Ultimate Alliance 2".</li>
|
31 |
-
<li>Go back to the folder where your Marvel Ultimate Alliance 2 game is installed on your computer.</li>
|
32 |
-
<li>Paste the copied folder and overwrite the existing one.</li>
|
33 |
-
<li>You should see a message asking if you want to replace the files in the destination. Click on "Yes" or "Replace All".</li>
|
34 |
-
</ol>
|
35 |
-
<h2>Step 4: Enjoy Your New Save Game File</h2>
|
36 |
-
<p>Congratulations! You have successfully downloaded and used a save game file for Marvel Ultimate Alliance 2 pc all character unlock with full level. Now</p>
|
37 |
-
<p></p> cec2833e83<br />
|
38 |
-
<br />
|
39 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1acneusushi/gradio-2dmoleculeeditor/data/Edius 7 Crack File Download How to Save Money and Ruin Your Computer.md
DELETED
@@ -1,23 +0,0 @@
|
|
1 |
-
<br />
|
2 |
-
<h1>How to Download and Install Edius 7 Crack File for Free</h1>
|
3 |
-
<p>Edius 7 is a powerful video editing software that can handle multiple formats and resolutions. It offers a range of features and tools to create professional-looking videos with ease. However, Edius 7 is not a free software and requires a license key to activate it. If you want to use Edius 7 without paying for it, you might be tempted to download and install a crack file from the internet. But is it safe and legal to do so? In this article, we will explain what a crack file is, how it works, and what are the risks and consequences of using it.</p>
|
4 |
-
<h2>edius 7 crack file download</h2><br /><p><b><b>Download</b> ✫ <a href="https://byltly.com/2uKvrR">https://byltly.com/2uKvrR</a></b></p><br /><br />
|
5 |
-
<h2>What is a crack file?</h2>
|
6 |
-
<p>A crack file is a modified version of an original software file that bypasses or removes the security features that prevent unauthorized use. A crack file can be an executable file, a patch, a keygen, or a serial number generator. A crack file is usually created by hackers or crackers who want to break the protection of a software and distribute it for free or for profit.</p>
|
7 |
-
<h2>How does a crack file work?</h2>
|
8 |
-
<p>A crack file works by altering the code or data of the original software file in order to disable or fool the activation process. For example, a crack file might replace the original license key verification function with a fake one that always returns true, or it might change the expiration date of the trial version to never expire. A crack file can also inject malicious code into the software that can harm your computer or steal your personal information.</p>
|
9 |
-
<h2>What are the risks and consequences of using a crack file?</h2>
|
10 |
-
<p>Using a crack file is not only illegal but also dangerous. Here are some of the risks and consequences of using a crack file:</p>
|
11 |
-
<p></p>
|
12 |
-
<ul>
|
13 |
-
<li>You might violate the intellectual property rights of the software developer and face legal action.</li>
|
14 |
-
<li>You might expose your computer to viruses, malware, spyware, ransomware, or other harmful programs that can damage your system or compromise your security.</li>
|
15 |
-
<li>You might lose your data or files due to corruption, deletion, encryption, or theft by the malicious code in the crack file.</li>
|
16 |
-
<li>You might experience poor performance, errors, crashes, or compatibility issues with the cracked software or other programs on your computer.</li>
|
17 |
-
<li>You might miss out on important updates, bug fixes, features, or support from the software developer.</li>
|
18 |
-
</ul>
|
19 |
-
<h2>How to download and install Edius 7 legally?</h2>
|
20 |
-
<p>The best way to download and install Edius 7 is to purchase it from the official website or an authorized reseller. You will get a genuine license key that will activate your software and grant you access to all its features and benefits. You will also get regular updates, technical support, and customer service from the software developer. You will also avoid any legal or ethical issues that might arise from using a crack file.</p>
|
21 |
-
<p>To purchase Edius 7, visit <a href="https://www.edius.net/">https://www.edius.net/</a> and choose the edition that suits your needs. You can also download a free trial version for 30 days before you buy. Follow the instructions on the website to complete your order and download your software. Once you have downloaded Edius 7, run the installer and enter your license key when prompted. Enjoy editing your videos with Edius 7!</p> ddb901b051<br />
|
22 |
-
<br />
|
23 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1line/AutoGPT/autogpt/chat.py
DELETED
@@ -1,175 +0,0 @@
|
|
1 |
-
import time
|
2 |
-
|
3 |
-
from openai.error import RateLimitError
|
4 |
-
|
5 |
-
from autogpt import token_counter
|
6 |
-
from autogpt.config import Config
|
7 |
-
from autogpt.llm_utils import create_chat_completion
|
8 |
-
from autogpt.logs import logger
|
9 |
-
|
10 |
-
cfg = Config()
|
11 |
-
|
12 |
-
|
13 |
-
def create_chat_message(role, content):
|
14 |
-
"""
|
15 |
-
Create a chat message with the given role and content.
|
16 |
-
|
17 |
-
Args:
|
18 |
-
role (str): The role of the message sender, e.g., "system", "user", or "assistant".
|
19 |
-
content (str): The content of the message.
|
20 |
-
|
21 |
-
Returns:
|
22 |
-
dict: A dictionary containing the role and content of the message.
|
23 |
-
"""
|
24 |
-
return {"role": role, "content": content}
|
25 |
-
|
26 |
-
|
27 |
-
def generate_context(prompt, relevant_memory, full_message_history, model):
|
28 |
-
current_context = [
|
29 |
-
create_chat_message("system", prompt),
|
30 |
-
create_chat_message(
|
31 |
-
"system", f"The current time and date is {time.strftime('%c')}"
|
32 |
-
),
|
33 |
-
create_chat_message(
|
34 |
-
"system",
|
35 |
-
f"This reminds you of these events from your past:\n{relevant_memory}\n\n",
|
36 |
-
),
|
37 |
-
]
|
38 |
-
|
39 |
-
# Add messages from the full message history until we reach the token limit
|
40 |
-
next_message_to_add_index = len(full_message_history) - 1
|
41 |
-
insertion_index = len(current_context)
|
42 |
-
# Count the currently used tokens
|
43 |
-
current_tokens_used = token_counter.count_message_tokens(current_context, model)
|
44 |
-
return (
|
45 |
-
next_message_to_add_index,
|
46 |
-
current_tokens_used,
|
47 |
-
insertion_index,
|
48 |
-
current_context,
|
49 |
-
)
|
50 |
-
|
51 |
-
|
52 |
-
# TODO: Change debug from hardcode to argument
|
53 |
-
def chat_with_ai(
|
54 |
-
prompt, user_input, full_message_history, permanent_memory, token_limit
|
55 |
-
):
|
56 |
-
"""Interact with the OpenAI API, sending the prompt, user input, message history,
|
57 |
-
and permanent memory."""
|
58 |
-
while True:
|
59 |
-
try:
|
60 |
-
"""
|
61 |
-
Interact with the OpenAI API, sending the prompt, user input,
|
62 |
-
message history, and permanent memory.
|
63 |
-
|
64 |
-
Args:
|
65 |
-
prompt (str): The prompt explaining the rules to the AI.
|
66 |
-
user_input (str): The input from the user.
|
67 |
-
full_message_history (list): The list of all messages sent between the
|
68 |
-
user and the AI.
|
69 |
-
permanent_memory (Obj): The memory object containing the permanent
|
70 |
-
memory.
|
71 |
-
token_limit (int): The maximum number of tokens allowed in the API call.
|
72 |
-
|
73 |
-
Returns:
|
74 |
-
str: The AI's response.
|
75 |
-
"""
|
76 |
-
model = cfg.fast_llm_model # TODO: Change model from hardcode to argument
|
77 |
-
# Reserve 1000 tokens for the response
|
78 |
-
|
79 |
-
logger.debug(f"Token limit: {token_limit}")
|
80 |
-
send_token_limit = token_limit - 1000
|
81 |
-
|
82 |
-
relevant_memory = (
|
83 |
-
""
|
84 |
-
if len(full_message_history) == 0
|
85 |
-
else permanent_memory.get_relevant(str(full_message_history[-9:]), 10)
|
86 |
-
)
|
87 |
-
|
88 |
-
logger.debug(f"Memory Stats: {permanent_memory.get_stats()}")
|
89 |
-
|
90 |
-
(
|
91 |
-
next_message_to_add_index,
|
92 |
-
current_tokens_used,
|
93 |
-
insertion_index,
|
94 |
-
current_context,
|
95 |
-
) = generate_context(prompt, relevant_memory, full_message_history, model)
|
96 |
-
|
97 |
-
while current_tokens_used > 2500:
|
98 |
-
# remove memories until we are under 2500 tokens
|
99 |
-
relevant_memory = relevant_memory[:-1]
|
100 |
-
(
|
101 |
-
next_message_to_add_index,
|
102 |
-
current_tokens_used,
|
103 |
-
insertion_index,
|
104 |
-
current_context,
|
105 |
-
) = generate_context(
|
106 |
-
prompt, relevant_memory, full_message_history, model
|
107 |
-
)
|
108 |
-
|
109 |
-
current_tokens_used += token_counter.count_message_tokens(
|
110 |
-
[create_chat_message("user", user_input)], model
|
111 |
-
) # Account for user input (appended later)
|
112 |
-
|
113 |
-
while next_message_to_add_index >= 0:
|
114 |
-
# print (f"CURRENT TOKENS USED: {current_tokens_used}")
|
115 |
-
message_to_add = full_message_history[next_message_to_add_index]
|
116 |
-
|
117 |
-
tokens_to_add = token_counter.count_message_tokens(
|
118 |
-
[message_to_add], model
|
119 |
-
)
|
120 |
-
if current_tokens_used + tokens_to_add > send_token_limit:
|
121 |
-
break
|
122 |
-
|
123 |
-
# Add the most recent message to the start of the current context,
|
124 |
-
# after the two system prompts.
|
125 |
-
current_context.insert(
|
126 |
-
insertion_index, full_message_history[next_message_to_add_index]
|
127 |
-
)
|
128 |
-
|
129 |
-
# Count the currently used tokens
|
130 |
-
current_tokens_used += tokens_to_add
|
131 |
-
|
132 |
-
# Move to the next most recent message in the full message history
|
133 |
-
next_message_to_add_index -= 1
|
134 |
-
|
135 |
-
# Append user input, the length of this is accounted for above
|
136 |
-
current_context.extend([create_chat_message("user", user_input)])
|
137 |
-
|
138 |
-
# Calculate remaining tokens
|
139 |
-
tokens_remaining = token_limit - current_tokens_used
|
140 |
-
# assert tokens_remaining >= 0, "Tokens remaining is negative.
|
141 |
-
# This should never happen, please submit a bug report at
|
142 |
-
# https://www.github.com/Torantulino/Auto-GPT"
|
143 |
-
|
144 |
-
# Debug print the current context
|
145 |
-
logger.debug(f"Token limit: {token_limit}")
|
146 |
-
logger.debug(f"Send Token Count: {current_tokens_used}")
|
147 |
-
logger.debug(f"Tokens remaining for response: {tokens_remaining}")
|
148 |
-
logger.debug("------------ CONTEXT SENT TO AI ---------------")
|
149 |
-
for message in current_context:
|
150 |
-
# Skip printing the prompt
|
151 |
-
if message["role"] == "system" and message["content"] == prompt:
|
152 |
-
continue
|
153 |
-
logger.debug(f"{message['role'].capitalize()}: {message['content']}")
|
154 |
-
logger.debug("")
|
155 |
-
logger.debug("----------- END OF CONTEXT ----------------")
|
156 |
-
|
157 |
-
# TODO: use a model defined elsewhere, so that model can contain
|
158 |
-
# temperature and other settings we care about
|
159 |
-
assistant_reply = create_chat_completion(
|
160 |
-
model=model,
|
161 |
-
messages=current_context,
|
162 |
-
max_tokens=tokens_remaining,
|
163 |
-
)
|
164 |
-
|
165 |
-
# Update full message history
|
166 |
-
full_message_history.append(create_chat_message("user", user_input))
|
167 |
-
full_message_history.append(
|
168 |
-
create_chat_message("assistant", assistant_reply)
|
169 |
-
)
|
170 |
-
|
171 |
-
return assistant_reply
|
172 |
-
except RateLimitError:
|
173 |
-
# TODO: When we switch to langchain, this is built in
|
174 |
-
print("Error: ", "API Rate Limit Reached. Waiting 10 seconds...")
|
175 |
-
time.sleep(10)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1line/AutoGPT/tests/unit/test_browse_scrape_links.py
DELETED
@@ -1,118 +0,0 @@
|
|
1 |
-
# Generated by CodiumAI
|
2 |
-
|
3 |
-
# Dependencies:
|
4 |
-
# pip install pytest-mock
|
5 |
-
import pytest
|
6 |
-
|
7 |
-
from autogpt.commands.web_requests import scrape_links
|
8 |
-
|
9 |
-
"""
|
10 |
-
Code Analysis
|
11 |
-
|
12 |
-
Objective:
|
13 |
-
The objective of the 'scrape_links' function is to scrape hyperlinks from a
|
14 |
-
given URL and return them in a formatted way.
|
15 |
-
|
16 |
-
Inputs:
|
17 |
-
- url: a string representing the URL to be scraped.
|
18 |
-
|
19 |
-
Flow:
|
20 |
-
1. Send a GET request to the given URL using the requests library and the user agent header from the config file.
|
21 |
-
2. Check if the response contains an HTTP error. If it does, return "error".
|
22 |
-
3. Parse the HTML content of the response using the BeautifulSoup library.
|
23 |
-
4. Remove any script and style tags from the parsed HTML.
|
24 |
-
5. Extract all hyperlinks from the parsed HTML using the 'extract_hyperlinks' function.
|
25 |
-
6. Format the extracted hyperlinks using the 'format_hyperlinks' function.
|
26 |
-
7. Return the formatted hyperlinks.
|
27 |
-
|
28 |
-
Outputs:
|
29 |
-
- A list of formatted hyperlinks.
|
30 |
-
|
31 |
-
Additional aspects:
|
32 |
-
- The function uses the 'requests' and 'BeautifulSoup' libraries to send HTTP
|
33 |
-
requests and parse HTML content, respectively.
|
34 |
-
- The 'extract_hyperlinks' function is called to extract hyperlinks from the parsed HTML.
|
35 |
-
- The 'format_hyperlinks' function is called to format the extracted hyperlinks.
|
36 |
-
- The function checks for HTTP errors and returns "error" if any are found.
|
37 |
-
"""
|
38 |
-
|
39 |
-
|
40 |
-
class TestScrapeLinks:
|
41 |
-
# Tests that the function returns a list of formatted hyperlinks when
|
42 |
-
# provided with a valid url that returns a webpage with hyperlinks.
|
43 |
-
def test_valid_url_with_hyperlinks(self):
|
44 |
-
url = "https://www.google.com"
|
45 |
-
result = scrape_links(url)
|
46 |
-
assert len(result) > 0
|
47 |
-
assert isinstance(result, list)
|
48 |
-
assert isinstance(result[0], str)
|
49 |
-
|
50 |
-
# Tests that the function returns correctly formatted hyperlinks when given a valid url.
|
51 |
-
def test_valid_url(self, mocker):
|
52 |
-
# Mock the requests.get() function to return a response with sample HTML containing hyperlinks
|
53 |
-
mock_response = mocker.Mock()
|
54 |
-
mock_response.status_code = 200
|
55 |
-
mock_response.text = (
|
56 |
-
"<html><body><a href='https://www.google.com'>Google</a></body></html>"
|
57 |
-
)
|
58 |
-
mocker.patch("requests.Session.get", return_value=mock_response)
|
59 |
-
|
60 |
-
# Call the function with a valid URL
|
61 |
-
result = scrape_links("https://www.example.com")
|
62 |
-
|
63 |
-
# Assert that the function returns correctly formatted hyperlinks
|
64 |
-
assert result == ["Google (https://www.google.com)"]
|
65 |
-
|
66 |
-
# Tests that the function returns "error" when given an invalid url.
|
67 |
-
def test_invalid_url(self, mocker):
|
68 |
-
# Mock the requests.get() function to return an HTTP error response
|
69 |
-
mock_response = mocker.Mock()
|
70 |
-
mock_response.status_code = 404
|
71 |
-
mocker.patch("requests.Session.get", return_value=mock_response)
|
72 |
-
|
73 |
-
# Call the function with an invalid URL
|
74 |
-
result = scrape_links("https://www.invalidurl.com")
|
75 |
-
|
76 |
-
# Assert that the function returns "error"
|
77 |
-
assert "Error:" in result
|
78 |
-
|
79 |
-
# Tests that the function returns an empty list when the html contains no hyperlinks.
|
80 |
-
def test_no_hyperlinks(self, mocker):
|
81 |
-
# Mock the requests.get() function to return a response with sample HTML containing no hyperlinks
|
82 |
-
mock_response = mocker.Mock()
|
83 |
-
mock_response.status_code = 200
|
84 |
-
mock_response.text = "<html><body><p>No hyperlinks here</p></body></html>"
|
85 |
-
mocker.patch("requests.Session.get", return_value=mock_response)
|
86 |
-
|
87 |
-
# Call the function with a URL containing no hyperlinks
|
88 |
-
result = scrape_links("https://www.example.com")
|
89 |
-
|
90 |
-
# Assert that the function returns an empty list
|
91 |
-
assert result == []
|
92 |
-
|
93 |
-
# Tests that scrape_links() correctly extracts and formats hyperlinks from
|
94 |
-
# a sample HTML containing a few hyperlinks.
|
95 |
-
def test_scrape_links_with_few_hyperlinks(self, mocker):
|
96 |
-
# Mock the requests.get() function to return a response with a sample HTML containing hyperlinks
|
97 |
-
mock_response = mocker.Mock()
|
98 |
-
mock_response.status_code = 200
|
99 |
-
mock_response.text = """
|
100 |
-
<html>
|
101 |
-
<body>
|
102 |
-
<div id="google-link"><a href="https://www.google.com">Google</a></div>
|
103 |
-
<div id="github"><a href="https://github.com">GitHub</a></div>
|
104 |
-
<div id="CodiumAI"><a href="https://www.codium.ai">CodiumAI</a></div>
|
105 |
-
</body>
|
106 |
-
</html>
|
107 |
-
"""
|
108 |
-
mocker.patch("requests.Session.get", return_value=mock_response)
|
109 |
-
|
110 |
-
# Call the function being tested
|
111 |
-
result = scrape_links("https://www.example.com")
|
112 |
-
|
113 |
-
# Assert that the function returns a list of formatted hyperlinks
|
114 |
-
assert isinstance(result, list)
|
115 |
-
assert len(result) == 3
|
116 |
-
assert result[0] == "Google (https://www.google.com)"
|
117 |
-
assert result[1] == "GitHub (https://github.com)"
|
118 |
-
assert result[2] == "CodiumAI (https://www.codium.ai)"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1pelhydcardo/ChatGPT-prompt-generator/assets/Arceus X How to Run PC Scripts on Your iOS or Android Phone.md
DELETED
@@ -1,145 +0,0 @@
|
|
1 |
-
<br />
|
2 |
-
<h1>Arceus X: How to Download and Play the Ultimate Roblox Mod Menu on iOS</h1>
|
3 |
-
<p>If you are a fan of Roblox, you might have heard of Arceus X, a mod menu that allows you to exploit your favorite games with features such as Android LuaU Execution, Infinite Jump, Super Speed, Btools, Script Hub, and more. Arceus X is a first and one of the most widely used Roblox Mod Menu/exploit specially developed for Android. But what if you want to play it on your iOS device? Is it possible to download and install Arceus X on iOS? The answer is yes, and in this article, we will show you how to do it step by step.</p>
|
4 |
-
<h2>What is Arceus X?</h2>
|
5 |
-
<p>Arceus X is a first Android Roblox Mod Menu/Exploit to improve the gameplay. It allows you to use features such as Android LuaU Execution, Infinite Jump, Super Speed, Btools, Script Hub, More!. Arceus X APK is developed using Node.js, C++, JAVA. It’s an Android application that has floating Menu to execute scripts while you are in the game.</p>
|
6 |
-
<h2>arceus x ios download</h2><br /><p><b><b>DOWNLOAD</b> ····· <a href="https://urlin.us/2uSXlv">https://urlin.us/2uSXlv</a></b></p><br /><br />
|
7 |
-
<h3>Features of Arceus X</h3>
|
8 |
-
<p>Some of the features that make Arceus X stand out from other Roblox mod menus are:</p>
|
9 |
-
<ul>
|
10 |
-
<li>Android LuaU Execution: You can run any Lua script on your Android device without any limitations.</li>
|
11 |
-
<li>Infinite Jump: You can jump as high as you want in any game.</li>
|
12 |
-
<li>Super Speed: You can move faster than normal in any game.</li>
|
13 |
-
<li>Btools: You can delete or modify any object in any game.</li>
|
14 |
-
<li>Script Hub: You can access a collection of scripts for various games from the mod menu.</li>
|
15 |
-
<li>More!: You can also use features such as Fly, Noclip, ESP, Aimbot, God Mode, and more.</li>
|
16 |
-
</ul>
|
17 |
-
<h3>Requirements for Arceus X</h3>
|
18 |
-
<p>To download and play Arceus X on your iOS device, you will need:</p>
|
19 |
-
<ul>
|
20 |
-
<li>An iOS device with iOS 10 or later.</li>
|
21 |
-
<li>An Android device or an emulator to get the Arceus X APK file.</li>
|
22 |
-
<li>A file manager app on your iOS device to transfer the APK file.</li>
|
23 |
-
<li>An iOS emulator app on your iOS device to run the APK file.</li>
|
24 |
-
<li>A Roblox account to play the games.</li>
|
25 |
-
</ul>
|
26 |
-
<h2>How to Download Arceus X on iOS</h2>
|
27 |
-
<p>Now that you know what Arceus X is and what you need to play it on your iOS device, let's get started with the download process. Here are the steps you need to follow:</p>
|
28 |
-
<h3>Step 1: Get the Arceus X APK file</h3>
|
29 |
-
<p>The first step is to get the Arceus X APK file from a reliable source. You can either use an Android device or an emulator on your PC to do this. Here are some options for getting the APK file:</p>
|
30 |
-
<ul>
|
31 |
-
<li>You can download it from the official website of Arceus X. Just click on the download button and complete the verification process. The APK file will be downloaded automatically.</li>
|
32 |
-
<li>You can watch a tutorial video on YouTube that shows you how to download and install Arceus X on your Android device. Just follow the instructions in the video and get the APK file.</ <li>You can join the Discord server of Arceus X and ask for the APK file from the developers or other users. You might need to verify your identity and follow some rules to get access to the file.</li>
|
33 |
-
</ul>
|
34 |
-
<p>Once you have the APK file, you need to transfer it to your iOS device. You can use a USB cable, Bluetooth, Wi-Fi, or any other method that works for you. Just make sure you have a file manager app on your iOS device to locate the APK file.</p>
|
35 |
-
<h3>Step 2: Install an iOS emulator</h3>
|
36 |
-
<p>The next step is to install an iOS emulator app on your iOS device that can run Android apps. An emulator is a software that mimics the behavior of another device or platform. There are many iOS emulators available on the App Store, but not all of them can run Arceus X smoothly. Here are some of the best iOS emulators that we recommend for Arceus X:</p>
|
37 |
-
<ul>
|
38 |
-
<li>iAndroid: This is one of the most popular and reliable iOS emulators that can run Android apps without any hassle. It has a simple interface and supports most of the Android features. You can download it from the App Store for free.</li>
|
39 |
-
<li>Cider: This is another iOS emulator that can run Android apps with ease. It has a fast performance and supports many Android games. You can download it from the official website for free.</li>
|
40 |
-
<li>Appetize.io: This is an online iOS emulator that can run Android apps on your browser. You don't need to install anything on your device, just upload the APK file and start playing. It has a high compatibility and supports many Android features. You can use it for free for 100 minutes per month, or upgrade to a paid plan for more time.</li>
|
41 |
-
</ul>
|
42 |
-
<p>Once you have installed an iOS emulator of your choice, you need to launch it and grant it the necessary permissions to access your device's storage, camera, microphone, etc.</p>
|
43 |
-
<h3>Step 3: Run the Arceus X APK file on the emulator</h3>
|
44 |
-
<p>The final step is to run the Arceus X APK file on the emulator and start playing. Here are the steps you need to follow:</p>
|
45 |
-
<p>arceus x v3 download tutorial<br />
|
46 |
-
arceus x apk official<br />
|
47 |
-
arceus x roblox mod menu<br />
|
48 |
-
arceus x v3.1.0 public beta<br />
|
49 |
-
arceus x android roblox exploit<br />
|
50 |
-
arceus x ios 16.0.4 install<br />
|
51 |
-
arceus x script executor for mobile<br />
|
52 |
-
arceus x apk without linkvertise<br />
|
53 |
-
arceus x roblox hack android<br />
|
54 |
-
arceus x v3 update download<br />
|
55 |
-
arceus x mod menu apk<br />
|
56 |
-
arceus x roblox cheat ios<br />
|
57 |
-
arceus x verification process<br />
|
58 |
-
arceus x apk free download<br />
|
59 |
-
arceus x roblox exploit ios<br />
|
60 |
-
arceus x v3 mod menu tutorial<br />
|
61 |
-
arceus x apk latest version<br />
|
62 |
-
arceus x roblox script hub<br />
|
63 |
-
arceus x verification bypass<br />
|
64 |
-
arceus x apk no ads<br />
|
65 |
-
arceus x roblox infinite jump<br />
|
66 |
-
arceus x v3 install guide<br />
|
67 |
-
arceus x apk direct download<br />
|
68 |
-
arceus x roblox super speed<br />
|
69 |
-
arceus x verification completed<br />
|
70 |
-
arceus x apk no verification<br />
|
71 |
-
arceus x roblox btools hack<br />
|
72 |
-
arceus x v3 download link<br />
|
73 |
-
arceus x apk easy download<br />
|
74 |
-
arceus x roblox luau execution<br />
|
75 |
-
arceus x verification failed fix<br />
|
76 |
-
arceus x apk no root<br />
|
77 |
-
arceus x roblox android modding<br />
|
78 |
-
arceus x v3 features overview<br />
|
79 |
-
arceus x apk fast download<br />
|
80 |
-
arceus x roblox exploit features<br />
|
81 |
-
arceus x verification steps explained<br />
|
82 |
-
arceus x apk safe download<br />
|
83 |
-
arceus x roblox pc scripts support<br />
|
84 |
-
arceus x v3 release date ios<br />
|
85 |
-
arceus x apk working download<br />
|
86 |
-
arceus x roblox exploit review<br />
|
87 |
-
arceus x verification code generator<br />
|
88 |
-
arceus x apk virus free download<br />
|
89 |
-
arceus x roblox exploit comparison</p>
|
90 |
-
<ol>
|
91 |
-
<li>Open the file manager app on your iOS device and locate the Arceus X APK file that you transferred earlier.</li>
|
92 |
-
<li>Tap on the APK file and select the option to open it with the emulator app that you installed.</li>
|
93 |
-
<li>The emulator will launch and install the Arceus X app on its virtual environment.</li>
|
94 |
-
<li>Once the installation is complete, you will see the Arceus X icon on the emulator's home screen.</li>
|
95 |
-
<li>Tap on the icon and log in with your Roblox account credentials.</li>
|
96 |
-
<li>You will see a floating mod menu on your screen with various options to exploit your favorite games.</li>
|
97 |
-
</ol>
|
98 |
-
<h3>Step 4: Enjoy the game</h3>
|
99 |
-
<p>Congratulations! You have successfully downloaded and installed Arceus X on your iOS device. Now you can enjoy playing Roblox with unlimited features and fun. You can access the mod menu anytime by tapping on it and selecting the options you want to use. You can also use the script hub to find and execute scripts for different games. Just be careful not to abuse the mod menu or get reported by other players, as you might get banned by Roblox.</p>
|
100 |
-
<h2>Tips and Tricks for Arceus X</h2>
|
101 |
-
<p>To make the most out of Arceus X, here are some tips and tricks that you should know:</p>
|
102 |
-
<h3>How to use the script hub</h3>
|
103 |
-
<p>The script hub is a feature that allows you to access a collection of scripts for various games from the mod menu. You can use these scripts to enhance your gameplay or perform certain actions that are not possible otherwise. Here are some steps to use the script hub:</p>
|
104 |
-
<ol>
|
105 |
-
<li>Tap on the mod menu and select the script hub option.</li>
|
106 |
-
<li>You will see a list of games that have scripts available for them.</li>
|
107 |
-
<li>Select the game that you want to play and tap on it.</li>
|
108 |
-
<li>You will see a list of scripts that you can use for that game.</li>
|
109 |
-
<li>Select the script that you want to use and tap on it.</li>
|
110 |
-
<li>The script will be executed automatically and you will see its effects in the game.</li>
|
111 |
-
</ol>
|
112 |
-
<h3>How to customize the mod menu</h3>
|
113 |
-
<p>The mod menu is a feature that allows you to customize various aspects of Arceus X, such as its appearance, position, size, transparency, etc. You can also enable or disable certain features or change their settings according to your preference. Here are some steps to customize the mod menu:</p>
|
114 |
-
<ol>
|
115 |
-
<li>Tap on the mod menu and select the settings option.</li>
|
116 |
-
<li>You will see a list of options that you can change, such as color, size, position, transparency, etc.</li>
|
117 |
-
<li>Select the option that you want to change and adjust it according to your liking.</li>
|
118 |
-
<li>You can also enable or disable certain features or change their settings by tapping on them.</li>
|
119 |
-
<li>Once you are done, tap on the save button to apply the changes.</li>
|
120 |
-
</ol>
|
121 |
-
<h3>How to avoid getting banned</h3>
|
122 |
-
<p>While Arceus X is a fun and powerful mod menu, it is also a risky one. If you use it too much or too blatantly, you might get detected and banned by Roblox. To avoid this, here are some tips that you should follow:</p>
|
123 |
-
<ul>
|
124 |
-
<li>Use the mod menu sparingly and discreetly. Don't use it in every game or every round. Don't use it in front of other players or moderators. Don't use it to ruin the game for others.</li>
|
125 |
-
<li>Use the anti-ban feature. This feature is designed to prevent Roblox from detecting your mod menu and banning you. It does this by changing your device ID, IP address, and other information that Roblox uses to identify you. You can enable this feature from the mod menu settings.</li>
|
126 |
-
<li>Use a VPN service. A VPN service is a tool that encrypts your internet traffic and hides your IP address and location. This can help you avoid getting banned by Roblox, as they won't be able to trace your activity or location. You can use any VPN service that works for you, but make sure it is reliable and secure.</li>
|
127 |
-
</ul>
|
128 |
-
<h2>Conclusion</h2>
|
129 |
-
<p>In this article, we have shown you how to download and play Arceus X on your iOS device. Arceus X is a first Android Roblox Mod Menu/Exploit that allows you to exploit your favorite games with features such as Android LuaU Execution, Infinite Jump, Super Speed, Btools, Script Hub, More!. To play it on your iOS device, you need to get the Arceus X APK file from a reliable source, install an iOS emulator app on your device, run the APK file on the emulator, and enjoy the game. We have also given you some tips and tricks for using Arceus X, such as how to use the script hub, how to customize the mod menu, and how to avoid getting banned. We hope you found this article helpful and informative. If you have any questions or feedback, feel free to leave a comment below.</p>
|
130 |
-
<h3>FAQs</h3>
|
131 |
-
<p>Here are some of the frequently asked questions about Arceus X:</p>
|
132 |
-
<ol>
|
133 |
-
<li><b>Is Arceus X safe to use?</b></li>
|
134 |
-
<p>Arceus X is safe to use as long as you download it from a trusted source and follow the instructions carefully. However, there is always a risk of getting banned by Roblox if you use it too much or too blatantly. To minimize this risk, use the anti-ban feature and a VPN service.</p>
|
135 |
-
<li><b>Is Arceus X free to use?</b></li>
|
136 |
-
<p>Yes, Arceus X is free to use and does not require any payment or subscription. However, you might need to complete some verification steps or watch some ads before downloading it.</p>
|
137 |
-
<li><b>Does Arceus X work on all games?</b></li>
|
138 |
-
<p>No, Arceus X does not work on all games. Some games have anti-cheat systems or scripts that prevent Arceus X from working properly. You can check the script hub for the list of games that have scripts available for them.</p>
|
139 |
-
<li><b>Can I use Arceus X on other devices?</b></li>
|
140 |
-
<p>Yes, you can use Arceus X on other devices besides iOS. You can use it on Android devices directly without any emulator. You can also use it on PC devices with an Android emulator such as BlueStacks or Nox Player.</p>
|
141 |
-
<li><b>Where can I get more information about Arceus X?</b></li>
|
142 |
-
<p>You can get more information about Arceus X from its official website, its YouTube channel, or its Discord server. You can also contact the developers or other users for support or feedback.</p>
|
143 |
-
</ol></p> 197e85843d<br />
|
144 |
-
<br />
|
145 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1phancelerku/anime-remove-background/Download Blockman Go v2.40.1 APK with Unlimited Money and Gems.md
DELETED
@@ -1,120 +0,0 @@
|
|
1 |
-
|
2 |
-
<h1>Blockman Go v2.40.1 APK: A Fun and Creative Sandbox Game</h1>
|
3 |
-
<p>If you are looking for a game that offers you a variety of fun and creative minigames, as well as a platform to chat and make friends with other players, then you should check out Blockman Go v2.40.1 APK. This is the latest version of the popular sandbox game that has millions of fans around the world.</p>
|
4 |
-
<h2>blockman go v2.40.1 apk</h2><br /><p><b><b>Download</b> ✯ <a href="https://jinyurl.com/2uNKMD">https://jinyurl.com/2uNKMD</a></b></p><br /><br />
|
5 |
-
<h2>What is Blockman Go?</h2>
|
6 |
-
<p>Blockman Go is a free app that lets you play various block style minigames with different themes and genres. You can join the games by a simple tap, or create your own games with your own rules and settings. You can also chat and make friends with other players in the game, and join clans and parties to play together.</p>
|
7 |
-
<h3>A free app with various minigames</h3>
|
8 |
-
<p>Blockman Go offers you a wide range of minigames to choose from, such as Bed Wars, Egg Wars, Sky Block, Murder Mystery, Survival Games, Capture Flag, Snowball Battle, Bow Spleef, TNT Run, and many more. Each minigame has its own gameplay, objectives, and challenges that will keep you entertained and engaged.</p>
|
9 |
-
<h3>A platform to chat and make friends</h3>
|
10 |
-
<p>Blockman Go is not just a game, but also a social platform where you can chat and make friends with other players from all over the world. You can use the chat function to communicate and cooperate with your teammates, or to have fun conversations with other players. You can also join clans and parties to play together, or send gifts and messages to your friends.</p>
|
11 |
-
<h3>A way to customize your avatar and show your style</h3>
|
12 |
-
<p>Blockman Go allows you to customize your avatar with various items and accessories that you can buy with gold or Gcubes (the premium currency of the game). You can change your hair, eyes, clothes, hats, glasses, masks, wings, tails, pets, weapons, vehicles, and more. You can also create your own skins and upload them to the game. With Blockman Go, you can show your unique style and personality to the world.</p>
|
13 |
-
<h2>What's New in Blockman Go v2.40.1 APK?</h2>
|
14 |
-
<p>Blockman Go v2.40.1 APK is the latest version of the game that was released on June 20th 2023. This version brings some new minigames and features, as well as some improvements and bug fixes.</p>
|
15 |
-
<p>blockman go 2.40.1 apk download<br />
|
16 |
-
blockman go 2.40.1 mod apk<br />
|
17 |
-
blockman go 2.40.1 apk free download<br />
|
18 |
-
blockman go 2.40.1 apk latest version<br />
|
19 |
-
blockman go 2.40.1 apk pure<br />
|
20 |
-
blockman go 2.40.1 apk for android<br />
|
21 |
-
blockman go 2.40.1 apk hack<br />
|
22 |
-
blockman go 2.40.1 apk unlimited money<br />
|
23 |
-
blockman go 2.40.1 apk old version<br />
|
24 |
-
blockman go 2.40.1 apk offline<br />
|
25 |
-
blockman go 2.40.1 apk update<br />
|
26 |
-
blockman go 2.40.1 apk no ads<br />
|
27 |
-
blockman go 2.40.1 apk premium<br />
|
28 |
-
blockman go 2.40.1 apk full version<br />
|
29 |
-
blockman go 2.40.1 apk cracked<br />
|
30 |
-
blockman go 2.40.1 apk mod menu<br />
|
31 |
-
blockman go 2.40.1 apk obb<br />
|
32 |
-
blockman go 2.40.1 apk revdl<br />
|
33 |
-
blockman go 2.40.1 apk rexdl<br />
|
34 |
-
blockman go 2.40.1 apk mirror<br />
|
35 |
-
blockman go 2.40.1 apk uptodown<br />
|
36 |
-
blockman go 2.40.1 apk apkpure.com[^1^]<br />
|
37 |
-
blockman go 2.40.1 apk android oyun club<br />
|
38 |
-
blockman go 2.40.1 apk happymod<br />
|
39 |
-
blockman go 2.40.1 apk modded<br />
|
40 |
-
blockman go 2.40.1 apk original<br />
|
41 |
-
blockman go 2.40.1 apk file download<br />
|
42 |
-
blockman go 2.40.1 apk install<br />
|
43 |
-
blockman go 2.40.1 apk direct link<br />
|
44 |
-
blockman go 2.40.1 apk google play<br />
|
45 |
-
blockman go 2.40.1 apk data download<br />
|
46 |
-
blockman go 2.40.1 apk unlocked all features<br />
|
47 |
-
blockman go 2.40.1 apk pro version<br />
|
48 |
-
blockman go 2.40.1 apk mega mod<br />
|
49 |
-
blockman go 2.40.1 apk cheat codes<br />
|
50 |
-
blockman go 2.40.1 apk unlimited cubes<br />
|
51 |
-
blockman go 2.40.1 apk unlimited gems<br />
|
52 |
-
blockman go 2,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,</p>
|
53 |
-
<h3>New minigames and features</h3>
|
54 |
-
<p>Some of the new minigames and features that are added in this version are:</p>
|
55 |
-
<ul>
|
56 |
-
<li><b>Party Street</b>: A new minigame where you can collect graffitis from all over the city and spray them to your heart's content. You can experience this super cool street style in the Party Street and hop into a random party with other players.</li>
|
57 |
-
<li><b>Blockman Go Studio</b>: A new feature where you can create your own videos and share them with other players. You can use various tools and effects to make your videos more interesting and creative. You can also watch and like other players' videos and get rewards.</li>
|
58 |
-
<li><b>Blockman Go Music</b>: A new feature where you can listen to music and podcasts from different genres and categories. You can also create your own playlists and share them with your friends. You can also discover new songs and artists from the recommendations and rankings.</li>
|
59 |
-
</ul>
|
60 |
-
<h3>Improved game experience and performance</h3>
|
61 |
-
<p>Some of the improvements and optimizations that are made in this version are:</p>
|
62 |
-
<ul>
|
63 |
-
<li><b>Reduced loading time and lag</b>: The game has been optimized to reduce the loading time and lag when entering or switching between minigames. The game also has a smoother performance and a better compatibility with different devices.</li>
|
64 |
-
<li><b>Enhanced graphics and sound effects</b>: The game has been enhanced to improve the graphics and sound effects of the minigames. The game also has a more realistic and immersive atmosphere and a better user interface.</li>
|
65 |
-
<li><b>Updated content and rewards</b>: The game has been updated to add more content and rewards for the players. The game also has a more balanced and fair gameplay and a better feedback system.</li>
|
66 |
-
</ul>
|
67 |
-
<h3>Bug fixes and optimizations</h3>
|
68 |
-
<p>Some of the bug fixes and optimizations that are done in this version are:</p>
|
69 |
-
<ul>
|
70 |
-
<li><b>Fixed some crashes and errors</b>: The game has been fixed to solve some crashes and errors that occurred in some minigames or features. The game also has a more stable and secure performance.</li>
|
71 |
-
<li><b>Fixed some glitches and exploits</b>: The game has been fixed to remove some glitches and exploits that affected the gameplay or the fairness of the minigames. The game also has a more consistent and reliable performance.</li>
|
72 |
-
<li><b>Fixed some typos and translations</b>: The game has been fixed to correct some typos and translations that appeared in some texts or dialogs. The game also has a more accurate and clear language.</li>
|
73 |
-
</ul>
|
74 |
-
<h2>How to Download and Install Blockman Go v2.40.1 APK?</h2>
|
75 |
-
<p>If you want to download and install Blockman Go v2.40.1 APK on your device, you can follow these simple steps:</p>
|
76 |
-
<h3>Download the APK file from a trusted source</h3>
|
77 |
-
<p>The first step is to download the APK file from a trusted source, such as [APKPure] or [Uptodown]. You can use the links below to download the file directly:</p>
|
78 |
-
<ul>
|
79 |
-
<li>[APKPure]: <a href="">https://apkpure.com/blockman-go-blocky-mods/com.sandboxol.blockymods/download?from=details</a></li>
|
80 |
-
<li>[Uptodown]: <a href="">https://blockman-go.en.uptodown.com/android/download/3787409</a></li>
|
81 |
-
</ul>
|
82 |
-
<p>The file size is about 150 MB, so make sure you have enough space on your device before downloading it.</p>
|
83 |
-
<h3>Enable unknown sources on your device settings</h3>
|
84 |
-
<p>The second step is to enable unknown sources on your device settings, so that you can install the APK file without any problems. You can do this by following these steps:</p>
|
85 |
-
<ul>
|
86 |
-
<li>Go to your device settings and look for the security or privacy option.</li>
|
87 |
-
<li>Find the option that says unknown sources or allow installation from unknown sources.</li>
|
88 |
-
<li>Toggle it on or check it to enable it.</li>
|
89 |
-
<li>You may get a warning message, but you can ignore it or confirm it.</li>
|
90 |
-
</ul>
|
91 |
-
<p>This will allow you to install apps that are not from the official app store, such as Blockman Go v2.40.1 APK.</p> <h3>Install the APK file and enjoy the game</h3>
|
92 |
-
<p>The third and final step is to install the APK file and enjoy the game. You can do this by following these steps:</p>
|
93 |
-
<ul>
|
94 |
-
<li>Locate the APK file that you downloaded on your device storage or file manager.</li>
|
95 |
-
<li>Tap on the file to open it and start the installation process.</li>
|
96 |
-
<li>You may get a prompt asking you to confirm the installation or grant some permissions. Just follow the instructions and allow what is necessary.</li>
|
97 |
-
<li>Wait for the installation to finish and then tap on the open or done button.</li>
|
98 |
-
</ul>
|
99 |
-
<p>Congratulations, you have successfully installed Blockman Go v2.40.1 APK on your device. You can now launch the game and enjoy the new features and minigames.</p>
|
100 |
-
<h2>Tips and Tricks to Play Blockman Go Better</h2>
|
101 |
-
<p>If you want to play Blockman Go better and have more fun, you can use some of these tips and tricks:</p>
|
102 |
-
<h3>Choose the right minigame for your preference and skill level</h3>
|
103 |
-
<p>Blockman Go has a lot of minigames to choose from, but not all of them may suit your preference or skill level. You can browse through the categories and genres of the minigames and find the ones that you like and are good at. You can also check the ratings, reviews, and descriptions of the minigames to get an idea of what they are about and how to play them.</p>
|
104 |
-
<h3>Use the chat function to communicate and cooperate with other players</h3>
|
105 |
-
<p>Blockman Go is a social game where you can chat and make friends with other players. You can use the chat function to communicate and cooperate with your teammates, or to have fun conversations with other players. You can also use emojis, stickers, voice messages, and gifs to express yourself better. You can also join clans and parties to play together, or send gifts and messages to your friends.</p>
|
106 |
-
<h3>Earn gold by playing minigames and use it to buy items and accessories</h3>
|
107 |
-
<p>Blockman Go allows you to earn gold by playing minigames and use it to buy items and accessories for your avatar. You can also earn Gcubes, which are the premium currency of the game, by completing tasks, watching ads, or buying them with real money. You can use gold and Gcubes to buy various items and accessories that will make your avatar more stylish and unique. You can also create your own skins and upload them to the game.</p>
|
108 |
-
<h2>Conclusion</h2>
|
109 |
-
<p>Blockman Go v2.40.1 APK is a fun and creative sandbox game that offers you a variety of block style minigames with different themes and genres. You can also chat and make friends with other players in the game, and customize your avatar with various items and accessories. You can download and install Blockman Go v2.40.1 APK on your device by following the simple steps above. You can also use some tips and tricks to play Blockman Go better and have more fun.</p>
|
110 |
-
<h2>FAQs</h2>
|
111 |
-
<p>Here are some frequently asked questions about Blockman Go v2.40.1 APK:</p>
|
112 |
-
<table>
|
113 |
-
<tr><td><b>Q: Is Blockman Go v2.40.1 APK safe to download and install?</b></td><td><b>A: Yes, Blockman Go v2.40.1 APK is safe to download and install, as long as you download it from a trusted source, such as [APKPure] or [Uptodown]. You should also enable unknown sources on your device settings before installing it.</b></td></tr>
|
114 |
-
<tr><td><b>Q: What are the requirements to play Blockman Go v2.40.1 APK?</b></td><td><b>A: Blockman Go v2.40.1 APK requires Android 4.4 or higher, as well as a stable internet connection. The game also requires about 150 MB of free space on your device.</b></td></tr>
|
115 |
-
<tr><td><b>Q: How can I update Blockman Go v2.40.1 APK?</b></td><td><b>A: You can update Blockman Go v2.40.1 APK by downloading the latest version from a trusted source, such as [APKPure] or [Uptodown], and installing it over the existing one. You can also check for updates within the game settings.</b></td></tr>
|
116 |
-
<tr><td><b>Q: How can I contact Blockman Go support team?</b></td><td><b>A: You can contact Blockman Go support team by sending an email to [email protected], or by visiting their official website at https://www .blockmango.net/.</b></td></tr>
|
117 |
-
<tr><td><b>Q: How can I get more gold and Gcubes in Blockman Go?</b></td><td><b>A: You can get more gold and Gcubes in Blockman Go by playing minigames and completing tasks, watching ads and videos, inviting friends and joining events, or buying them with real money.</b></td></tr>
|
118 |
-
</table></p> 197e85843d<br />
|
119 |
-
<br />
|
120 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/1phancelerku/anime-remove-background/Enjoy Messenger on Your Desktop with the Official Windows App.md
DELETED
@@ -1,183 +0,0 @@
|
|
1 |
-
|
2 |
-
<h1>How to Download Messenger for Windows</h1>
|
3 |
-
<p>Do you want to stay connected with your friends and family on Messenger, but don't want to use your phone or browser? If so, you might be interested in downloading Messenger for Windows, a desktop app that lets you use Messenger on your PC or Mac. In this article, we will show you how to download, install, and use Messenger for Windows, as well as how to troubleshoot some common issues. Let's get started!</p>
|
4 |
-
<h2>What is Messenger for Windows?</h2>
|
5 |
-
<p>Messenger for Windows is a desktop app that lets you use Messenger on your Windows or Mac computer. It is similar to the mobile app, but with some additional features that make it more convenient and enjoyable to use on a larger screen. With Messenger for Windows, you can:</p>
|
6 |
-
<h2>download messenger for windows</h2><br /><p><b><b>Download File</b> ► <a href="https://jinyurl.com/2uNLns">https://jinyurl.com/2uNLns</a></b></p><br /><br />
|
7 |
-
<ul>
|
8 |
-
<li>Text, audio, and video chat with anyone on Messenger, Facebook, or Instagram.</li>
|
9 |
-
<li>Make group calls with up to 50 people.</li>
|
10 |
-
<li>Share photos, videos, GIFs, stickers, and more.</li>
|
11 |
-
<li>Watch videos together with Watch Together.</li>
|
12 |
-
<li>Play games with your friends.</li>
|
13 |
-
<li>Create rooms where you can hang out with anyone you want.</li>
|
14 |
-
<li>Access your chats across devices.</li>
|
15 |
-
<li>Use dark mode, themes, and other customization options.</li>
|
16 |
-
</ul>
|
17 |
-
<p>Messenger for Windows is free to download and use. All you need is a Facebook account or a phone number.</p>
|
18 |
-
<h2>Why Download Messenger for Windows?</h2>
|
19 |
-
<p>There are many benefits of using Messenger for Windows instead of your phone or browser. Here are some of them:</p>
|
20 |
-
<ul>
|
21 |
-
<li>You can enjoy a larger and clearer view of your chats and calls.</li>
|
22 |
-
<li>You can use your keyboard and mouse to type faster and navigate easier.</li>
|
23 |
-
<li>You can multitask without switching between tabs or apps.</li>
|
24 |
-
<li>You can get notifications on your desktop without opening your browser.</li>
|
25 |
-
<li>You can save battery life on your phone.</li>
|
26 |
-
</ul>
|
27 |
-
<p>If you want to experience these benefits, read on to learn how to download and install Messenger for Windows.</p>
|
28 |
-
<h2>How to Download and Install Messenger for Windows</h2>
|
29 |
-
<p>There are three ways to download and install Messenger for Windows: from Messenger.com, from Microsoft Store, or from Mac App Store. We will explain each method below.</p>
|
30 |
-
<h3>Download from Messenger.com</h3>
|
31 |
-
<p>This is the easiest way to get the app. Here are the steps:</p>
|
32 |
-
<p>How to download messenger for windows 10<br />
|
33 |
-
Download messenger for windows desktop app<br />
|
34 |
-
Download messenger for windows without facebook account<br />
|
35 |
-
Download messenger for windows 7 free<br />
|
36 |
-
Download messenger for windows 8.1<br />
|
37 |
-
Download messenger for windows laptop<br />
|
38 |
-
Download messenger for windows offline installer<br />
|
39 |
-
Download messenger for windows 10 64 bit<br />
|
40 |
-
Download messenger for windows and mac<br />
|
41 |
-
Download messenger for windows from microsoft store<br />
|
42 |
-
Download messenger for windows latest version<br />
|
43 |
-
Download messenger for windows pc free<br />
|
44 |
-
Download messenger for windows xp<br />
|
45 |
-
Download messenger for windows phone<br />
|
46 |
-
Download messenger for windows 10 pro<br />
|
47 |
-
Download messenger for windows with video call<br />
|
48 |
-
Download messenger for windows full version<br />
|
49 |
-
Download messenger for windows 7 32 bit<br />
|
50 |
-
Download messenger for windows vista<br />
|
51 |
-
Download messenger for windows 10 home<br />
|
52 |
-
Download messenger for windows without bluestacks<br />
|
53 |
-
Download messenger for windows with dark mode<br />
|
54 |
-
Download messenger for windows 10 update<br />
|
55 |
-
Download messenger for windows 7 ultimate<br />
|
56 |
-
Download messenger for windows old version<br />
|
57 |
-
Download messenger for windows using qr code<br />
|
58 |
-
Download messenger for windows with stickers<br />
|
59 |
-
Download messenger for windows 10 laptop<br />
|
60 |
-
Download messenger for windows 7 professional<br />
|
61 |
-
Download messenger for windows not working<br />
|
62 |
-
Download messenger for windows with games<br />
|
63 |
-
Download messenger for windows 10 free download<br />
|
64 |
-
Download messenger for windows 7 starter<br />
|
65 |
-
Download messenger for windows error code 1603<br />
|
66 |
-
Download messenger for windows with voice messages<br />
|
67 |
-
Download messenger for windows 10 mobile<br />
|
68 |
-
Download messenger for windows 7 home premium<br />
|
69 |
-
Download messenger for windows installation failed<br />
|
70 |
-
Download messenger for windows with emojis<br />
|
71 |
-
Download messenger for windows 10 pc free download</p>
|
72 |
-
<ol>
|
73 |
-
<li>Go to <a href="(^1^)">Messenger.com</a>.</li>
|
74 |
-
<li>Click on <strong>Download</strong>.</li>
|
75 |
-
<li>The desktop app will automatically download based on the desktop device you are using. If it doesn't start automatically, click on <strong>Restart</strong>.</li>
|
76 |
-
<li>Once the download is complete, click on the installer file to run it.</li>
|
77 |
-
<li> <li>Follow the instructions on the screen to complete the installation.</li>
|
78 |
-
<li>Launch the app and log in with your Facebook account or phone number.</li>
|
79 |
-
</ol>
|
80 |
-
<p>Congratulations, you have successfully downloaded and installed Messenger for Windows from Messenger.com!</p>
|
81 |
-
<h3>Download from Microsoft Store</h3>
|
82 |
-
<p>This is another way to get the app if you are using a Windows 10 device. Here are the steps:</p>
|
83 |
-
<ol>
|
84 |
-
<li>Go to <a href="">Microsoft Store</a>.</li>
|
85 |
-
<li>Search for <strong>Messenger</strong>.</li>
|
86 |
-
<li>Select the app with the blue logo and the name <strong>Messenger for Windows 10</strong>.</li>
|
87 |
-
<li>Click on <strong>Get</strong>.</li>
|
88 |
-
<li>The app will start downloading and installing on your device.</li>
|
89 |
-
<li>Launch the app and log in with your Facebook account or phone number.</li>
|
90 |
-
</ol>
|
91 |
-
<p>Congratulations, you have successfully downloaded and installed Messenger for Windows from Microsoft Store!</p>
|
92 |
-
<h3>Download from Mac App Store</h3>
|
93 |
-
<p>This is the way to get the app if you are using a Mac device. Here are the steps:</p>
|
94 |
-
<ol>
|
95 |
-
<li>Go to <a href="">Mac App Store</a>.</li>
|
96 |
-
<li>Search for <strong>Messenger</strong>.</li>
|
97 |
-
<li>Select the app with the blue logo and the name <strong>Messenger for macOS</strong>.</li>
|
98 |
-
<li>Click on <strong>Get</strong>.</li>
|
99 |
-
<li>The app will start downloading and installing on your device.</li>
|
100 |
-
<li>Launch the app and log in with your Facebook account or phone number.</li>
|
101 |
-
</ol>
|
102 |
-
<p>Congratulations, you have successfully downloaded and installed Messenger for Windows from Mac App Store!</p>
|
103 |
-
<h2>How to Use Messenger for Windows</h2>
|
104 |
-
<p>Now that you have downloaded and installed Messenger for Windows, you might be wondering how to use it effectively. Here are some tips and tricks for using the app:</p>
|
105 |
-
<h3>How to Log in and Out</h3>
|
106 |
-
<p>To log in to Messenger for Windows, you need to enter your Facebook account or phone number and password. If you don't have a Facebook account, you can create one by clicking on <strong>Create New Account</strong>. You can also choose to stay logged in by checking the box next to <strong>Keep me signed in</strong>.</p>
|
107 |
-
<p>To log out of Messenger for Windows, you need to click on your profile picture in the top left corner of the app. Then, click on <strong>Log Out</strong>. You can also switch accounts by clicking on <strong>Switch Account</strong>.</p>
|
108 |
-
<h3>How to Chat and Call</h3>
|
109 |
-
<p>To chat with someone on Messenger for Windows, you need to click on their name in the left sidebar of the app. You can also search for someone by typing their name or phone number in the search bar at the top of the app. You can then type your message in the text box at the bottom of the chat window. You can also send photos, videos, GIFs, stickers, emojis, and more by clicking on the icons next to the text box.</p>
|
110 |
-
<p>To make a voice or video call with someone on Messenger for Windows, you need to click on their name in the left sidebar of the app. Then, click on the phone or camera icon at the top right corner of the chat window. You can also join a group call by clicking on the group name in the left sidebar of the app. Then, click on <strong>Join Call</strong>. You can also create a room where you can invite anyone you want to join by clicking on <strong>Create a Room</strong>.</p>
|
111 |
-
<h3>How to Manage Notifications and Settings</h3>
|
112 |
-
<p>To manage your notifications and settings on Messenger for Windows, you need to click on your profile picture in the top left corner of the app. Then, click on <strong>Preferences</strong>. You can then customize your preferences and privacy options, such as:</p>
|
113 |
-
<ul>
|
114 |
-
<li>Mute notifications for specific chats or all chats.</li>
|
115 |
-
<li>Show or hide message previews.</li>
|
116 |
-
<li>Show or hide active status.</li>
|
117 |
-
<li>Show or hide chat heads.</li>
|
118 |
-
<li>Change theme, color, emoji, or nickname for specific chats.</li>
|
119 |
-
<li>Block or report someone.</li>
|
120 |
-
<li>Delete or archive a chat.</li>
|
121 |
-
<li>Edit your profile information.</li>
|
122 |
-
<li>Switch between light mode and dark mode.</li>
|
123 |
-
</ul>
|
124 |
-
<h2>Troubleshooting Messenger for Windows</h2>
|
125 |
-
<p>Sometimes, you might encounter some issues while using Messenger for Windows. Here are some common issues and solutions for using the app:</p>
|
126 |
-
<h3>How to Update the App</h3>
|
127 |
-
<p>To update Messenger for Windows, you need to follow these steps:</p>
|
128 |
-
<ol>
|
129 |
-
<li>Go to <a href="">Messenger.com</a>.</li>
|
130 |
-
<li>Click on <strong>Download</strong>.</li>
|
131 |
-
<li>The latest version of the app will automatically download based on the desktop device you are using. If it doesn't start automatically, click on <strong>Restart</strong>.</li>
|
132 |
-
<li>Once the download is complete, click on the installer file to run it.</li>
|
133 |
-
<li>Follow the instructions on the screen to complete the installation.</li>
|
134 |
-
<li>Launch the app and log in with your Facebook account or phone number.</li>
|
135 |
-
</ol>
|
136 |
-
<p>You can also check for updates manually by clicking on your profile picture in the top left corner of the app. Then, click on <strong>About Messenger</strong>. If there is an update available, you will see a notification and a button to download it.</p>
|
137 |
-
<h3>How to Uninstall the App</h3>
|
138 |
-
<p>To uninstall Messenger for Windows, you need to follow these steps:</p>
|
139 |
-
<ol>
|
140 |
-
<li>Close the app if it is running.</li>
|
141 |
-
<li>Go to <strong>Control Panel</strong> on your Windows device or <strong>Finder</strong> on your Mac device.</li>
|
142 |
-
<li>Select <strong>Programs and Features</strong> on Windows or <strong>Applications</strong> on Mac.</li>
|
143 |
-
<li>Find and select <strong>Messenger for Windows</strong>.</li>
|
144 |
-
<li>Click on <strong>Uninstall</strong> on Windows or drag the app to the <strong>Trash</strong> on Mac.</li>
|
145 |
-
<li>Follow the instructions on the screen to complete the uninstallation.</li>
|
146 |
-
</ol>
|
147 |
-
<p>Note that uninstalling the app will not delete your chats or account. You can still access them on your phone or browser.</p>
|
148 |
-
<h3>How to Contact Support</h3>
|
149 |
-
<p>If you have any questions or issues that are not covered in this article, you can contact the Messenger support team or community for help. Here are some ways to do that:</p>
|
150 |
-
<ul>
|
151 |
-
<li>Go to <a href="">Messenger Help Center</a>. You can find answers to common questions, report a problem, or give feedback.</li>
|
152 |
-
<li>Go to <a href="">Messenger Community Forum</a>. You can join discussions with other users, ask questions, or share tips and tricks.</li>
|
153 |
-
<li>Contact Messenger on Facebook or Twitter. You can send a message or tweet to their official accounts and get a response from their support team.</li>
|
154 |
-
</ul>
|
155 |
-
<h2>Conclusion</h2>
|
156 |
-
<p>Messenger for Windows is a great way to stay connected with your friends and family on Messenger, without using your phone or browser. It offers many features and benefits that make it more convenient and enjoyable to use on a larger screen. In this article, we showed you how to download, install, and use Messenger for Windows, as well as how to troubleshoot some common issues. We hope you found this article helpful and informative. If you did, please share it with your friends and family who might also be interested in downloading Messenger for Windows. Thank you for reading!</p>
|
157 |
-
<h2>FAQs</h2>
|
158 |
-
<p>Here are some frequently asked questions and answers about Messenger for Windows:</p>
|
159 |
-
<h4>Q: Is Messenger for Windows safe?</h4>
|
160 |
-
<p>A: Yes, Messenger for Windows is safe to use. It uses encryption to protect your messages and calls from hackers and third parties. It also lets you control your privacy settings and block or report anyone who bothers you.</p>
|
161 |
-
<h4>Q: Is Messenger for Windows compatible with my device?</h4>
|
162 |
-
<p>A: Messenger for Windows is compatible with Windows 10 devices and Mac devices running macOS 10.10 or higher. It is not compatible with older versions of Windows or Mac, or other operating systems such as Linux.</p>
|
163 |
-
<h4>Q: How much space does Messenger for Windows take up?</h4>
|
164 |
-
<p>A: Messenger for Windows takes up about 200 MB of space on your device. This may vary depending on your device model and settings.</p>
|
165 |
-
<h4>Q: How do I watch videos together with my friends on Messenger for Windows?</h4>
|
166 |
-
<p>A: To watch videos together with your friends on Messenger for Windows, you need to use the Watch Together feature. Here are the steps:</p>
|
167 |
-
<ol>
|
168 |
-
<li>Start a video call with one or more friends.</li>
|
169 |
-
<li>Click on the TV icon at the bottom of the call window.</li>
|
170 |
-
<li>Select a video from the suggested list or search for one.</li>
|
171 |
-
<li>Click on <strong>Watch Together</strong>.</li>
|
172 |
-
<li>You and your friends can now watch the video together and chat at the same time.</li>
|
173 |
-
</ol>
|
174 |
-
<h4>Q: How do I play games with my friends on Messenger for Windows?</ <p>A: To play games with your friends on Messenger for Windows, you need to use the Games feature. Here are the steps:</p>
|
175 |
-
<ol>
|
176 |
-
<li>Click on the game controller icon in the left sidebar of the app.</li>
|
177 |
-
<li>Select a game from the list or search for one.</li>
|
178 |
-
<li>Click on <strong>Play</strong>.</li>
|
179 |
-
<li>You can play the game solo or challenge your friends to beat your score.</li>
|
180 |
-
<li>You can also chat with your friends while playing the game.</li>
|
181 |
-
</ol></p> 401be4b1e0<br />
|
182 |
-
<br />
|
183 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/44ov41za8i/FreeVC/speaker_encoder/audio.py
DELETED
@@ -1,107 +0,0 @@
|
|
1 |
-
from scipy.ndimage.morphology import binary_dilation
|
2 |
-
from speaker_encoder.params_data import *
|
3 |
-
from pathlib import Path
|
4 |
-
from typing import Optional, Union
|
5 |
-
import numpy as np
|
6 |
-
import webrtcvad
|
7 |
-
import librosa
|
8 |
-
import struct
|
9 |
-
|
10 |
-
int16_max = (2 ** 15) - 1
|
11 |
-
|
12 |
-
|
13 |
-
def preprocess_wav(fpath_or_wav: Union[str, Path, np.ndarray],
|
14 |
-
source_sr: Optional[int] = None):
|
15 |
-
"""
|
16 |
-
Applies the preprocessing operations used in training the Speaker Encoder to a waveform
|
17 |
-
either on disk or in memory. The waveform will be resampled to match the data hyperparameters.
|
18 |
-
|
19 |
-
:param fpath_or_wav: either a filepath to an audio file (many extensions are supported, not
|
20 |
-
just .wav), either the waveform as a numpy array of floats.
|
21 |
-
:param source_sr: if passing an audio waveform, the sampling rate of the waveform before
|
22 |
-
preprocessing. After preprocessing, the waveform's sampling rate will match the data
|
23 |
-
hyperparameters. If passing a filepath, the sampling rate will be automatically detected and
|
24 |
-
this argument will be ignored.
|
25 |
-
"""
|
26 |
-
# Load the wav from disk if needed
|
27 |
-
if isinstance(fpath_or_wav, str) or isinstance(fpath_or_wav, Path):
|
28 |
-
wav, source_sr = librosa.load(fpath_or_wav, sr=None)
|
29 |
-
else:
|
30 |
-
wav = fpath_or_wav
|
31 |
-
|
32 |
-
# Resample the wav if needed
|
33 |
-
if source_sr is not None and source_sr != sampling_rate:
|
34 |
-
wav = librosa.resample(wav, source_sr, sampling_rate)
|
35 |
-
|
36 |
-
# Apply the preprocessing: normalize volume and shorten long silences
|
37 |
-
wav = normalize_volume(wav, audio_norm_target_dBFS, increase_only=True)
|
38 |
-
wav = trim_long_silences(wav)
|
39 |
-
|
40 |
-
return wav
|
41 |
-
|
42 |
-
|
43 |
-
def wav_to_mel_spectrogram(wav):
|
44 |
-
"""
|
45 |
-
Derives a mel spectrogram ready to be used by the encoder from a preprocessed audio waveform.
|
46 |
-
Note: this not a log-mel spectrogram.
|
47 |
-
"""
|
48 |
-
frames = librosa.feature.melspectrogram(
|
49 |
-
y=wav,
|
50 |
-
sr=sampling_rate,
|
51 |
-
n_fft=int(sampling_rate * mel_window_length / 1000),
|
52 |
-
hop_length=int(sampling_rate * mel_window_step / 1000),
|
53 |
-
n_mels=mel_n_channels
|
54 |
-
)
|
55 |
-
return frames.astype(np.float32).T
|
56 |
-
|
57 |
-
|
58 |
-
def trim_long_silences(wav):
|
59 |
-
"""
|
60 |
-
Ensures that segments without voice in the waveform remain no longer than a
|
61 |
-
threshold determined by the VAD parameters in params.py.
|
62 |
-
|
63 |
-
:param wav: the raw waveform as a numpy array of floats
|
64 |
-
:return: the same waveform with silences trimmed away (length <= original wav length)
|
65 |
-
"""
|
66 |
-
# Compute the voice detection window size
|
67 |
-
samples_per_window = (vad_window_length * sampling_rate) // 1000
|
68 |
-
|
69 |
-
# Trim the end of the audio to have a multiple of the window size
|
70 |
-
wav = wav[:len(wav) - (len(wav) % samples_per_window)]
|
71 |
-
|
72 |
-
# Convert the float waveform to 16-bit mono PCM
|
73 |
-
pcm_wave = struct.pack("%dh" % len(wav), *(np.round(wav * int16_max)).astype(np.int16))
|
74 |
-
|
75 |
-
# Perform voice activation detection
|
76 |
-
voice_flags = []
|
77 |
-
vad = webrtcvad.Vad(mode=3)
|
78 |
-
for window_start in range(0, len(wav), samples_per_window):
|
79 |
-
window_end = window_start + samples_per_window
|
80 |
-
voice_flags.append(vad.is_speech(pcm_wave[window_start * 2:window_end * 2],
|
81 |
-
sample_rate=sampling_rate))
|
82 |
-
voice_flags = np.array(voice_flags)
|
83 |
-
|
84 |
-
# Smooth the voice detection with a moving average
|
85 |
-
def moving_average(array, width):
|
86 |
-
array_padded = np.concatenate((np.zeros((width - 1) // 2), array, np.zeros(width // 2)))
|
87 |
-
ret = np.cumsum(array_padded, dtype=float)
|
88 |
-
ret[width:] = ret[width:] - ret[:-width]
|
89 |
-
return ret[width - 1:] / width
|
90 |
-
|
91 |
-
audio_mask = moving_average(voice_flags, vad_moving_average_width)
|
92 |
-
audio_mask = np.round(audio_mask).astype(np.bool)
|
93 |
-
|
94 |
-
# Dilate the voiced regions
|
95 |
-
audio_mask = binary_dilation(audio_mask, np.ones(vad_max_silence_length + 1))
|
96 |
-
audio_mask = np.repeat(audio_mask, samples_per_window)
|
97 |
-
|
98 |
-
return wav[audio_mask == True]
|
99 |
-
|
100 |
-
|
101 |
-
def normalize_volume(wav, target_dBFS, increase_only=False, decrease_only=False):
|
102 |
-
if increase_only and decrease_only:
|
103 |
-
raise ValueError("Both increase only and decrease only are set")
|
104 |
-
dBFS_change = target_dBFS - 10 * np.log10(np.mean(wav ** 2))
|
105 |
-
if (dBFS_change < 0 and increase_only) or (dBFS_change > 0 and decrease_only):
|
106 |
-
return wav
|
107 |
-
return wav * (10 ** (dBFS_change / 20))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/A666sxr/Genshin_TTS/text/mandarin.py
DELETED
@@ -1,328 +0,0 @@
|
|
1 |
-
import os
|
2 |
-
import sys
|
3 |
-
import re
|
4 |
-
from pypinyin import lazy_pinyin, BOPOMOFO
|
5 |
-
import jieba
|
6 |
-
import cn2an
|
7 |
-
|
8 |
-
|
9 |
-
# List of (Latin alphabet, bopomofo) pairs:
|
10 |
-
_latin_to_bopomofo = [(re.compile('%s' % x[0], re.IGNORECASE), x[1]) for x in [
|
11 |
-
('a', 'ㄟˉ'),
|
12 |
-
('b', 'ㄅㄧˋ'),
|
13 |
-
('c', 'ㄙㄧˉ'),
|
14 |
-
('d', 'ㄉㄧˋ'),
|
15 |
-
('e', 'ㄧˋ'),
|
16 |
-
('f', 'ㄝˊㄈㄨˋ'),
|
17 |
-
('g', 'ㄐㄧˋ'),
|
18 |
-
('h', 'ㄝˇㄑㄩˋ'),
|
19 |
-
('i', 'ㄞˋ'),
|
20 |
-
('j', 'ㄐㄟˋ'),
|
21 |
-
('k', 'ㄎㄟˋ'),
|
22 |
-
('l', 'ㄝˊㄛˋ'),
|
23 |
-
('m', 'ㄝˊㄇㄨˋ'),
|
24 |
-
('n', 'ㄣˉ'),
|
25 |
-
('o', 'ㄡˉ'),
|
26 |
-
('p', 'ㄆㄧˉ'),
|
27 |
-
('q', 'ㄎㄧㄡˉ'),
|
28 |
-
('r', 'ㄚˋ'),
|
29 |
-
('s', 'ㄝˊㄙˋ'),
|
30 |
-
('t', 'ㄊㄧˋ'),
|
31 |
-
('u', 'ㄧㄡˉ'),
|
32 |
-
('v', 'ㄨㄧˉ'),
|
33 |
-
('w', 'ㄉㄚˋㄅㄨˋㄌㄧㄡˋ'),
|
34 |
-
('x', 'ㄝˉㄎㄨˋㄙˋ'),
|
35 |
-
('y', 'ㄨㄞˋ'),
|
36 |
-
('z', 'ㄗㄟˋ')
|
37 |
-
]]
|
38 |
-
|
39 |
-
# List of (bopomofo, romaji) pairs:
|
40 |
-
_bopomofo_to_romaji = [(re.compile('%s' % x[0]), x[1]) for x in [
|
41 |
-
('ㄅㄛ', 'p⁼wo'),
|
42 |
-
('ㄆㄛ', 'pʰwo'),
|
43 |
-
('ㄇㄛ', 'mwo'),
|
44 |
-
('ㄈㄛ', 'fwo'),
|
45 |
-
('ㄅ', 'p⁼'),
|
46 |
-
('ㄆ', 'pʰ'),
|
47 |
-
('ㄇ', 'm'),
|
48 |
-
('ㄈ', 'f'),
|
49 |
-
('ㄉ', 't⁼'),
|
50 |
-
('ㄊ', 'tʰ'),
|
51 |
-
('ㄋ', 'n'),
|
52 |
-
('ㄌ', 'l'),
|
53 |
-
('ㄍ', 'k⁼'),
|
54 |
-
('ㄎ', 'kʰ'),
|
55 |
-
('ㄏ', 'h'),
|
56 |
-
('ㄐ', 'ʧ⁼'),
|
57 |
-
('ㄑ', 'ʧʰ'),
|
58 |
-
('ㄒ', 'ʃ'),
|
59 |
-
('ㄓ', 'ʦ`⁼'),
|
60 |
-
('ㄔ', 'ʦ`ʰ'),
|
61 |
-
('ㄕ', 's`'),
|
62 |
-
('ㄖ', 'ɹ`'),
|
63 |
-
('ㄗ', 'ʦ⁼'),
|
64 |
-
('ㄘ', 'ʦʰ'),
|
65 |
-
('ㄙ', 's'),
|
66 |
-
('ㄚ', 'a'),
|
67 |
-
('ㄛ', 'o'),
|
68 |
-
('ㄜ', 'ə'),
|
69 |
-
('ㄝ', 'e'),
|
70 |
-
('ㄞ', 'ai'),
|
71 |
-
('ㄟ', 'ei'),
|
72 |
-
('ㄠ', 'au'),
|
73 |
-
('ㄡ', 'ou'),
|
74 |
-
('ㄧㄢ', 'yeNN'),
|
75 |
-
('ㄢ', 'aNN'),
|
76 |
-
('ㄧㄣ', 'iNN'),
|
77 |
-
('ㄣ', 'əNN'),
|
78 |
-
('ㄤ', 'aNg'),
|
79 |
-
('ㄧㄥ', 'iNg'),
|
80 |
-
('ㄨㄥ', 'uNg'),
|
81 |
-
('ㄩㄥ', 'yuNg'),
|
82 |
-
('ㄥ', 'əNg'),
|
83 |
-
('ㄦ', 'əɻ'),
|
84 |
-
('ㄧ', 'i'),
|
85 |
-
('ㄨ', 'u'),
|
86 |
-
('ㄩ', 'ɥ'),
|
87 |
-
('ˉ', '→'),
|
88 |
-
('ˊ', '↑'),
|
89 |
-
('ˇ', '↓↑'),
|
90 |
-
('ˋ', '↓'),
|
91 |
-
('˙', ''),
|
92 |
-
(',', ','),
|
93 |
-
('。', '.'),
|
94 |
-
('!', '!'),
|
95 |
-
('?', '?'),
|
96 |
-
('—', '-')
|
97 |
-
]]
|
98 |
-
|
99 |
-
# List of (romaji, ipa) pairs:
|
100 |
-
_romaji_to_ipa = [(re.compile('%s' % x[0], re.IGNORECASE), x[1]) for x in [
|
101 |
-
('ʃy', 'ʃ'),
|
102 |
-
('ʧʰy', 'ʧʰ'),
|
103 |
-
('ʧ⁼y', 'ʧ⁼'),
|
104 |
-
('NN', 'n'),
|
105 |
-
('Ng', 'ŋ'),
|
106 |
-
('y', 'j'),
|
107 |
-
('h', 'x')
|
108 |
-
]]
|
109 |
-
|
110 |
-
# List of (bopomofo, ipa) pairs:
|
111 |
-
_bopomofo_to_ipa = [(re.compile('%s' % x[0]), x[1]) for x in [
|
112 |
-
('ㄅㄛ', 'p⁼wo'),
|
113 |
-
('ㄆㄛ', 'pʰwo'),
|
114 |
-
('ㄇㄛ', 'mwo'),
|
115 |
-
('ㄈㄛ', 'fwo'),
|
116 |
-
('ㄅ', 'p⁼'),
|
117 |
-
('ㄆ', 'pʰ'),
|
118 |
-
('ㄇ', 'm'),
|
119 |
-
('ㄈ', 'f'),
|
120 |
-
('ㄉ', 't⁼'),
|
121 |
-
('ㄊ', 'tʰ'),
|
122 |
-
('ㄋ', 'n'),
|
123 |
-
('ㄌ', 'l'),
|
124 |
-
('ㄍ', 'k⁼'),
|
125 |
-
('ㄎ', 'kʰ'),
|
126 |
-
('ㄏ', 'x'),
|
127 |
-
('ㄐ', 'tʃ⁼'),
|
128 |
-
('ㄑ', 'tʃʰ'),
|
129 |
-
('ㄒ', 'ʃ'),
|
130 |
-
('ㄓ', 'ts`⁼'),
|
131 |
-
('ㄔ', 'ts`ʰ'),
|
132 |
-
('ㄕ', 's`'),
|
133 |
-
('ㄖ', 'ɹ`'),
|
134 |
-
('ㄗ', 'ts⁼'),
|
135 |
-
('ㄘ', 'tsʰ'),
|
136 |
-
('ㄙ', 's'),
|
137 |
-
('ㄚ', 'a'),
|
138 |
-
('ㄛ', 'o'),
|
139 |
-
('ㄜ', 'ə'),
|
140 |
-
('ㄝ', 'ɛ'),
|
141 |
-
('ㄞ', 'aɪ'),
|
142 |
-
('ㄟ', 'eɪ'),
|
143 |
-
('ㄠ', 'ɑʊ'),
|
144 |
-
('ㄡ', 'oʊ'),
|
145 |
-
('ㄧㄢ', 'jɛn'),
|
146 |
-
('ㄩㄢ', 'ɥæn'),
|
147 |
-
('ㄢ', 'an'),
|
148 |
-
('ㄧㄣ', 'in'),
|
149 |
-
('ㄩㄣ', 'ɥn'),
|
150 |
-
('ㄣ', 'ən'),
|
151 |
-
('ㄤ', 'ɑŋ'),
|
152 |
-
('ㄧㄥ', 'iŋ'),
|
153 |
-
('ㄨㄥ', 'ʊŋ'),
|
154 |
-
('ㄩㄥ', 'jʊŋ'),
|
155 |
-
('ㄥ', 'əŋ'),
|
156 |
-
('ㄦ', 'əɻ'),
|
157 |
-
('ㄧ', 'i'),
|
158 |
-
('ㄨ', 'u'),
|
159 |
-
('ㄩ', 'ɥ'),
|
160 |
-
('ˉ', '→'),
|
161 |
-
('ˊ', '↑'),
|
162 |
-
('ˇ', '↓↑'),
|
163 |
-
('ˋ', '↓'),
|
164 |
-
('˙', ''),
|
165 |
-
(',', ','),
|
166 |
-
('。', '.'),
|
167 |
-
('!', '!'),
|
168 |
-
('?', '?'),
|
169 |
-
('—', '-')
|
170 |
-
]]
|
171 |
-
|
172 |
-
# List of (bopomofo, ipa2) pairs:
|
173 |
-
_bopomofo_to_ipa2 = [(re.compile('%s' % x[0]), x[1]) for x in [
|
174 |
-
('ㄅㄛ', 'pwo'),
|
175 |
-
('ㄆㄛ', 'pʰwo'),
|
176 |
-
('ㄇㄛ', 'mwo'),
|
177 |
-
('ㄈㄛ', 'fwo'),
|
178 |
-
('ㄅ', 'p'),
|
179 |
-
('ㄆ', 'pʰ'),
|
180 |
-
('ㄇ', 'm'),
|
181 |
-
('ㄈ', 'f'),
|
182 |
-
('ㄉ', 't'),
|
183 |
-
('ㄊ', 'tʰ'),
|
184 |
-
('ㄋ', 'n'),
|
185 |
-
('ㄌ', 'l'),
|
186 |
-
('ㄍ', 'k'),
|
187 |
-
('ㄎ', 'kʰ'),
|
188 |
-
('ㄏ', 'h'),
|
189 |
-
('ㄐ', 'tɕ'),
|
190 |
-
('ㄑ', 'tɕʰ'),
|
191 |
-
('ㄒ', 'ɕ'),
|
192 |
-
('ㄓ', 'tʂ'),
|
193 |
-
('ㄔ', 'tʂʰ'),
|
194 |
-
('ㄕ', 'ʂ'),
|
195 |
-
('ㄖ', 'ɻ'),
|
196 |
-
('ㄗ', 'ts'),
|
197 |
-
('ㄘ', 'tsʰ'),
|
198 |
-
('ㄙ', 's'),
|
199 |
-
('ㄚ', 'a'),
|
200 |
-
('ㄛ', 'o'),
|
201 |
-
('ㄜ', 'ɤ'),
|
202 |
-
('ㄝ', 'ɛ'),
|
203 |
-
('ㄞ', 'aɪ'),
|
204 |
-
('ㄟ', 'eɪ'),
|
205 |
-
('ㄠ', 'ɑʊ'),
|
206 |
-
('ㄡ', 'oʊ'),
|
207 |
-
('ㄧㄢ', 'jɛn'),
|
208 |
-
('ㄩㄢ', 'yæn'),
|
209 |
-
('ㄢ', 'an'),
|
210 |
-
('ㄧㄣ', 'in'),
|
211 |
-
('ㄩㄣ', 'yn'),
|
212 |
-
('ㄣ', 'ən'),
|
213 |
-
('ㄤ', 'ɑŋ'),
|
214 |
-
('ㄧㄥ', 'iŋ'),
|
215 |
-
('ㄨㄥ', 'ʊŋ'),
|
216 |
-
('ㄩㄥ', 'jʊŋ'),
|
217 |
-
('ㄥ', 'ɤŋ'),
|
218 |
-
('ㄦ', 'əɻ'),
|
219 |
-
('ㄧ', 'i'),
|
220 |
-
('ㄨ', 'u'),
|
221 |
-
('ㄩ', 'y'),
|
222 |
-
('ˉ', '˥'),
|
223 |
-
('ˊ', '˧˥'),
|
224 |
-
('ˇ', '˨˩˦'),
|
225 |
-
('ˋ', '˥˩'),
|
226 |
-
('˙', ''),
|
227 |
-
(',', ','),
|
228 |
-
('。', '.'),
|
229 |
-
('!', '!'),
|
230 |
-
('?', '?'),
|
231 |
-
('—', '-')
|
232 |
-
]]
|
233 |
-
|
234 |
-
|
235 |
-
def number_to_chinese(text):
|
236 |
-
numbers = re.findall(r'\d+(?:\.?\d+)?', text)
|
237 |
-
for number in numbers:
|
238 |
-
text = text.replace(number, cn2an.an2cn(number), 1)
|
239 |
-
return text
|
240 |
-
|
241 |
-
|
242 |
-
def chinese_to_bopomofo(text, taiwanese=False):
|
243 |
-
text = text.replace('、', ',').replace(';', ',').replace(':', ',')
|
244 |
-
words = jieba.lcut(text, cut_all=False)
|
245 |
-
text = ''
|
246 |
-
for word in words:
|
247 |
-
bopomofos = lazy_pinyin(word, BOPOMOFO)
|
248 |
-
if not re.search('[\u4e00-\u9fff]', word):
|
249 |
-
text += word
|
250 |
-
continue
|
251 |
-
for i in range(len(bopomofos)):
|
252 |
-
bopomofos[i] = re.sub(r'([\u3105-\u3129])$', r'\1ˉ', bopomofos[i])
|
253 |
-
if text != '':
|
254 |
-
text += ' '
|
255 |
-
if taiwanese:
|
256 |
-
text += '#'+'#'.join(bopomofos)
|
257 |
-
else:
|
258 |
-
text += ''.join(bopomofos)
|
259 |
-
return text
|
260 |
-
|
261 |
-
|
262 |
-
def latin_to_bopomofo(text):
|
263 |
-
for regex, replacement in _latin_to_bopomofo:
|
264 |
-
text = re.sub(regex, replacement, text)
|
265 |
-
return text
|
266 |
-
|
267 |
-
|
268 |
-
def bopomofo_to_romaji(text):
|
269 |
-
for regex, replacement in _bopomofo_to_romaji:
|
270 |
-
text = re.sub(regex, replacement, text)
|
271 |
-
return text
|
272 |
-
|
273 |
-
|
274 |
-
def bopomofo_to_ipa(text):
|
275 |
-
for regex, replacement in _bopomofo_to_ipa:
|
276 |
-
text = re.sub(regex, replacement, text)
|
277 |
-
return text
|
278 |
-
|
279 |
-
|
280 |
-
def bopomofo_to_ipa2(text):
|
281 |
-
for regex, replacement in _bopomofo_to_ipa2:
|
282 |
-
text = re.sub(regex, replacement, text)
|
283 |
-
return text
|
284 |
-
|
285 |
-
|
286 |
-
def chinese_to_romaji(text):
|
287 |
-
text = number_to_chinese(text)
|
288 |
-
text = chinese_to_bopomofo(text)
|
289 |
-
text = latin_to_bopomofo(text)
|
290 |
-
text = bopomofo_to_romaji(text)
|
291 |
-
text = re.sub('i([aoe])', r'y\1', text)
|
292 |
-
text = re.sub('u([aoəe])', r'w\1', text)
|
293 |
-
text = re.sub('([ʦsɹ]`[⁼ʰ]?)([→↓↑ ]+|$)',
|
294 |
-
r'\1ɹ`\2', text).replace('ɻ', 'ɹ`')
|
295 |
-
text = re.sub('([ʦs][⁼ʰ]?)([→↓↑ ]+|$)', r'\1ɹ\2', text)
|
296 |
-
return text
|
297 |
-
|
298 |
-
|
299 |
-
def chinese_to_lazy_ipa(text):
|
300 |
-
text = chinese_to_romaji(text)
|
301 |
-
for regex, replacement in _romaji_to_ipa:
|
302 |
-
text = re.sub(regex, replacement, text)
|
303 |
-
return text
|
304 |
-
|
305 |
-
|
306 |
-
def chinese_to_ipa(text):
|
307 |
-
text = number_to_chinese(text)
|
308 |
-
text = chinese_to_bopomofo(text)
|
309 |
-
text = latin_to_bopomofo(text)
|
310 |
-
text = bopomofo_to_ipa(text)
|
311 |
-
text = re.sub('i([aoe])', r'j\1', text)
|
312 |
-
text = re.sub('u([aoəe])', r'w\1', text)
|
313 |
-
text = re.sub('([sɹ]`[⁼ʰ]?)([→↓↑ ]+|$)',
|
314 |
-
r'\1ɹ`\2', text).replace('ɻ', 'ɹ`')
|
315 |
-
text = re.sub('([s][⁼ʰ]?)([→↓↑ ]+|$)', r'\1ɹ\2', text)
|
316 |
-
return text
|
317 |
-
|
318 |
-
|
319 |
-
def chinese_to_ipa2(text, taiwanese=False):
|
320 |
-
text = number_to_chinese(text)
|
321 |
-
text = chinese_to_bopomofo(text, taiwanese)
|
322 |
-
text = latin_to_bopomofo(text)
|
323 |
-
text = bopomofo_to_ipa2(text)
|
324 |
-
text = re.sub(r'i([aoe])', r'j\1', text)
|
325 |
-
text = re.sub(r'u([aoəe])', r'w\1', text)
|
326 |
-
text = re.sub(r'([ʂɹ]ʰ?)([˩˨˧˦˥ ]+|$)', r'\1ʅ\2', text)
|
327 |
-
text = re.sub(r'(sʰ?)([˩˨˧˦˥ ]+|$)', r'\1ɿ\2', text)
|
328 |
-
return text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/AI-Dashboards/HEDIS.Assessment.PHQ9.GADD7.SDoH/README.md
DELETED
@@ -1,10 +0,0 @@
|
|
1 |
-
---
|
2 |
-
title: AI.Dashboard.PHQ9.GAD7.SDOH
|
3 |
-
emoji: 🏢
|
4 |
-
colorFrom: red
|
5 |
-
colorTo: gray
|
6 |
-
sdk: static
|
7 |
-
pinned: false
|
8 |
-
---
|
9 |
-
|
10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/AIWaves/Debate/src/agents/Agent/__init__.py
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
from .Agent import Agent
|
|
|
|
spaces/AIZero2HeroBootcamp/3DHuman/app.py
DELETED
@@ -1,27 +0,0 @@
|
|
1 |
-
import time
|
2 |
-
import gradio as gr
|
3 |
-
import os
|
4 |
-
|
5 |
-
|
6 |
-
def load_mesh(mesh_file_name):
|
7 |
-
time.sleep(2)
|
8 |
-
return mesh_file_name
|
9 |
-
|
10 |
-
description="3D Virtual Food 🥐🥑🥒🥓🥔🥕🥖🥗🥘🥙🥚🥛🥜🥝🥞🥟🥠🥡🥢🥣🥤🥥🥦🥧🥨🥩🥪🥫🥬🥭🥮🥯"
|
11 |
-
|
12 |
-
inputs = gr.Model3D()
|
13 |
-
outputs = gr.Model3D(clear_color=[0.8, 0.2, 0.2, 1.0])
|
14 |
-
|
15 |
-
demo = gr.Interface(
|
16 |
-
fn=load_mesh,
|
17 |
-
inputs=inputs,
|
18 |
-
outputs=outputs,
|
19 |
-
examples=[
|
20 |
-
[os.path.join(os.path.dirname(__file__), "FinalBaseMesh.obj")],
|
21 |
-
[os.path.join(os.path.dirname(__file__), "BEAR_BLK.OBJ")]
|
22 |
-
],
|
23 |
-
description=description,
|
24 |
-
cache_examples=True,
|
25 |
-
)
|
26 |
-
|
27 |
-
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/AIatUIUC/CodeLATS/lats/lats_main.py
DELETED
@@ -1,78 +0,0 @@
|
|
1 |
-
import os
|
2 |
-
import argparse
|
3 |
-
|
4 |
-
from lats import run_lats
|
5 |
-
|
6 |
-
|
7 |
-
def get_args():
|
8 |
-
parser = argparse.ArgumentParser()
|
9 |
-
parser.add_argument("--run_name", type=str, help="The name of the run")
|
10 |
-
parser.add_argument("--root_dir", type=str,
|
11 |
-
help="The root logging directory", default="root")
|
12 |
-
parser.add_argument("--dataset_path", type=str,
|
13 |
-
help="The path to the benchmark dataset", default="root")
|
14 |
-
parser.add_argument("--strategy", type=str,
|
15 |
-
help="Strategy: `simple`, `reflexion`")
|
16 |
-
parser.add_argument("--language", type=str, help="Strategy: `py` or `rs`")
|
17 |
-
parser.add_argument(
|
18 |
-
"--model", type=str, help="OpenAI models only for now. For best results, use GPT-4")
|
19 |
-
parser.add_argument("--pass_at_k", type=int,
|
20 |
-
help="Pass@k metric", default=1)
|
21 |
-
parser.add_argument("--max_iters", type=int,
|
22 |
-
help="The maximum number of self-improvement iterations", default=10)
|
23 |
-
parser.add_argument("--expansion_factor", type=int,
|
24 |
-
help="The expansion factor for the reflexion UCS and A* strategy", default=3)
|
25 |
-
parser.add_argument("--verbose", action='store_true',
|
26 |
-
help="To print live logs")
|
27 |
-
parser.add_argument("--instruction", type=str,
|
28 |
-
help="text string", default="")
|
29 |
-
parser.add_argument("--n_samples", type=int,
|
30 |
-
help="The number of nodes added during expansion", default=3)
|
31 |
-
parser.add_argument("--depth", type=int,
|
32 |
-
help="Tree depth", default=5)
|
33 |
-
|
34 |
-
# TODO: implement this
|
35 |
-
# parser.add_argument("--is_resume", action='store_true', help="To resume run")
|
36 |
-
# parser.add_argument("--resume_dir", type=str, help="If resume, the logging directory", default="")
|
37 |
-
args = parser.parse_args()
|
38 |
-
return args
|
39 |
-
|
40 |
-
|
41 |
-
def strategy_factory(strategy: str):
|
42 |
-
def kwargs_wrapper_gen(func, delete_keys=[]):
|
43 |
-
def kwargs_wrapper(**kwargs):
|
44 |
-
for key in delete_keys:
|
45 |
-
del kwargs[key]
|
46 |
-
return func(**kwargs)
|
47 |
-
return kwargs_wrapper
|
48 |
-
|
49 |
-
return kwargs_wrapper_gen(run_lats, delete_keys=[])
|
50 |
-
|
51 |
-
|
52 |
-
def lats_main(args):
|
53 |
-
|
54 |
-
# check if the strategy is valid
|
55 |
-
run_strategy = strategy_factory(args.strategy)
|
56 |
-
|
57 |
-
# start the run
|
58 |
-
# evaluate with pass@k
|
59 |
-
x = run_strategy(
|
60 |
-
model_name=args.model,
|
61 |
-
language=args.language,
|
62 |
-
max_iters=args.max_iters,
|
63 |
-
verbose=args.verbose,
|
64 |
-
instruction=args.instruction,
|
65 |
-
n_samples=args.n_samples,
|
66 |
-
depth=args.depth
|
67 |
-
)
|
68 |
-
|
69 |
-
return x
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
def main(args):
|
74 |
-
lats_main(args)
|
75 |
-
|
76 |
-
if __name__ == "__main__":
|
77 |
-
args = get_args()
|
78 |
-
main(args)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/AchyuthGamer/OpenGPT/g4f/Provider/deprecated/AiService.py
DELETED
@@ -1,36 +0,0 @@
|
|
1 |
-
from __future__ import annotations
|
2 |
-
|
3 |
-
import requests
|
4 |
-
|
5 |
-
from ...typing import Any, CreateResult
|
6 |
-
from ..base_provider import BaseProvider
|
7 |
-
|
8 |
-
|
9 |
-
class AiService(BaseProvider):
|
10 |
-
url = "https://aiservice.vercel.app/"
|
11 |
-
working = False
|
12 |
-
supports_gpt_35_turbo = True
|
13 |
-
|
14 |
-
@staticmethod
|
15 |
-
def create_completion(
|
16 |
-
model: str,
|
17 |
-
messages: list[dict[str, str]],
|
18 |
-
stream: bool,
|
19 |
-
**kwargs: Any,
|
20 |
-
) -> CreateResult:
|
21 |
-
base = "\n".join(f"{message['role']}: {message['content']}" for message in messages)
|
22 |
-
base += "\nassistant: "
|
23 |
-
|
24 |
-
headers = {
|
25 |
-
"accept": "*/*",
|
26 |
-
"content-type": "text/plain;charset=UTF-8",
|
27 |
-
"sec-fetch-dest": "empty",
|
28 |
-
"sec-fetch-mode": "cors",
|
29 |
-
"sec-fetch-site": "same-origin",
|
30 |
-
"Referer": "https://aiservice.vercel.app/chat",
|
31 |
-
}
|
32 |
-
data = {"input": base}
|
33 |
-
url = "https://aiservice.vercel.app/api/chat/answer"
|
34 |
-
response = requests.post(url, headers=headers, json=data)
|
35 |
-
response.raise_for_status()
|
36 |
-
yield response.json()["data"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/AgentVerse/agentVerse/ui/src/phaser3-rex-plugins/templates/ui/circularprogress/Factory.d.ts
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
import CircularProgress from './CircularProgress';
|
2 |
-
|
3 |
-
export default function (
|
4 |
-
config?: CircularProgress.IConfig
|
5 |
-
): CircularProgress;
|
6 |
-
|
7 |
-
export default function (
|
8 |
-
x?: number, y?: number,
|
9 |
-
radius?: number,
|
10 |
-
barColor?: string | number,
|
11 |
-
value?: number,
|
12 |
-
config?: CircularProgress.IConfig
|
13 |
-
): CircularProgress;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/AgentVerse/agentVerse/ui/src/phaser3-rex-plugins/templates/ui/dialog/Dialog.js
DELETED
@@ -1,306 +0,0 @@
|
|
1 |
-
import Sizer from '../sizer/Sizer.js';
|
2 |
-
import OverlapSizer from '../overlapsizer/OverlapSizer.js';
|
3 |
-
import Buttons from '../buttons/Buttons.js';
|
4 |
-
import FixWidthButtons from '../fixwidthbuttons/FixWidthButtons.js';
|
5 |
-
import GridButtons from '../gridbuttons/GridButtons.js';
|
6 |
-
import Methods from './methods/Methods.js';
|
7 |
-
|
8 |
-
const GetValue = Phaser.Utils.Objects.GetValue;
|
9 |
-
|
10 |
-
class Dialog extends Sizer {
|
11 |
-
constructor(scene, config) {
|
12 |
-
if (config === undefined) {
|
13 |
-
config = {};
|
14 |
-
}
|
15 |
-
// Create sizer
|
16 |
-
config.orientation = 1; // Top to bottom
|
17 |
-
super(scene, config);
|
18 |
-
this.type = 'rexDialog';
|
19 |
-
this.eventEmitter = GetValue(config, 'eventEmitter', this);
|
20 |
-
|
21 |
-
// Add elements
|
22 |
-
var background = GetValue(config, 'background', undefined);
|
23 |
-
var title = GetValue(config, 'title', undefined);
|
24 |
-
var toolbar = GetValue(config, 'toolbar', undefined);
|
25 |
-
var toolbarBackground = GetValue(config, 'toolbarBackground', undefined);
|
26 |
-
var leftToolbar = GetValue(config, 'leftToolbar', undefined);
|
27 |
-
var leftToolbarBackground = GetValue(config, 'leftToolbarBackground', undefined);
|
28 |
-
var content = GetValue(config, 'content', undefined);
|
29 |
-
var description = GetValue(config, 'description', undefined);
|
30 |
-
var choicesSizer;
|
31 |
-
var choices = GetValue(config, 'choices', undefined);
|
32 |
-
var choicesBackground = GetValue(config, 'choicesBackground', undefined);
|
33 |
-
var actionsSizer;
|
34 |
-
var actions = GetValue(config, 'actions', undefined);
|
35 |
-
var actionsBackground = GetValue(config, 'actionsBackground', undefined);
|
36 |
-
var clickConfig = GetValue(config, 'click', undefined);
|
37 |
-
|
38 |
-
if (background) {
|
39 |
-
this.addBackground(background);
|
40 |
-
}
|
41 |
-
|
42 |
-
var toolbarSizer;
|
43 |
-
if (toolbar) {
|
44 |
-
toolbarSizer = new Buttons(scene, {
|
45 |
-
groupName: 'toolbar',
|
46 |
-
background: toolbarBackground,
|
47 |
-
buttons: toolbar,
|
48 |
-
orientation: 0, // Left-right
|
49 |
-
space: { item: GetValue(config, 'space.toolbarItem', 0) },
|
50 |
-
click: clickConfig,
|
51 |
-
eventEmitter: this.eventEmitter,
|
52 |
-
});
|
53 |
-
}
|
54 |
-
|
55 |
-
var leftToolbarSizer;
|
56 |
-
if (leftToolbar) {
|
57 |
-
leftToolbarSizer = new Buttons(scene, {
|
58 |
-
groupName: 'leftToolbar',
|
59 |
-
background: leftToolbarBackground,
|
60 |
-
buttons: leftToolbar,
|
61 |
-
orientation: 0, // Left-right
|
62 |
-
space: { item: GetValue(config, 'space.leftToolbarItem', 0) },
|
63 |
-
click: clickConfig,
|
64 |
-
eventEmitter: this.eventEmitter,
|
65 |
-
});
|
66 |
-
}
|
67 |
-
|
68 |
-
// title or toolbar or leftToolbar
|
69 |
-
if (title || toolbar || leftToolbar) {
|
70 |
-
var titleExpandWidth = !!title && GetValue(config, 'expand.title', true);
|
71 |
-
var titleAlign = GetValue(config, 'align.title', 'center');
|
72 |
-
var useOverlapSizer =
|
73 |
-
// Has title, title is not exapnd-width, title align to center
|
74 |
-
(title && !titleExpandWidth && (titleAlign === 'center')) ||
|
75 |
-
// No title
|
76 |
-
(!title && (toolbar || leftToolbar));
|
77 |
-
var useSizer = !useOverlapSizer;
|
78 |
-
|
79 |
-
var titleSizer;
|
80 |
-
if (useSizer) {
|
81 |
-
titleSizer = new Sizer(scene, { orientation: 0 });
|
82 |
-
} else {
|
83 |
-
titleSizer = new OverlapSizer(scene);
|
84 |
-
}
|
85 |
-
|
86 |
-
var titleChildExpand = (useSizer) ? true : { height: true };
|
87 |
-
|
88 |
-
// Add leftToolbar
|
89 |
-
if (leftToolbarSizer) {
|
90 |
-
titleSizer.add(
|
91 |
-
leftToolbarSizer,
|
92 |
-
{ align: 'left', expand: titleChildExpand }
|
93 |
-
);
|
94 |
-
}
|
95 |
-
|
96 |
-
// Add title
|
97 |
-
if (title) {
|
98 |
-
// Add space if not expand, align to right
|
99 |
-
if (useSizer && !titleExpandWidth && (titleAlign === 'right')) {
|
100 |
-
titleSizer.addSpace();
|
101 |
-
}
|
102 |
-
|
103 |
-
var padding = {
|
104 |
-
left: GetValue(config, 'space.titleLeft', 0),
|
105 |
-
right: GetValue(config, 'space.titleRight', 0)
|
106 |
-
}
|
107 |
-
var proportion = (titleExpandWidth) ? 1 : 0;
|
108 |
-
titleSizer.add(
|
109 |
-
title,
|
110 |
-
{ align: titleAlign, proportion: proportion, expand: titleChildExpand, padding: padding }
|
111 |
-
);
|
112 |
-
|
113 |
-
// Add space if not expand, align to left
|
114 |
-
if (useSizer && !titleExpandWidth && (titleAlign === 'left')) {
|
115 |
-
titleSizer.addSpace();
|
116 |
-
}
|
117 |
-
}
|
118 |
-
|
119 |
-
// Add toolbar
|
120 |
-
if (toolbarSizer) {
|
121 |
-
// Add space if not title
|
122 |
-
if (useSizer && !title) {
|
123 |
-
titleSizer.addSpace();
|
124 |
-
}
|
125 |
-
titleSizer.add(
|
126 |
-
toolbarSizer,
|
127 |
-
{ align: 'right', expand: titleChildExpand }
|
128 |
-
);
|
129 |
-
}
|
130 |
-
|
131 |
-
// Add sizer to dialog
|
132 |
-
var titleSpace = GetValue(config, 'space.title', 0);
|
133 |
-
var padding;
|
134 |
-
if (content || description || choices || actions) {
|
135 |
-
padding = { bottom: titleSpace };
|
136 |
-
}
|
137 |
-
var proportion = GetValue(config, 'proportion.title', 0);
|
138 |
-
this.add(
|
139 |
-
titleSizer,
|
140 |
-
{ padding: padding, proportion: proportion, expand: true }
|
141 |
-
);
|
142 |
-
}
|
143 |
-
|
144 |
-
if (content) {
|
145 |
-
var align = GetValue(config, 'align.content', 'center');
|
146 |
-
var contentSpace = GetValue(config, 'space.content', 0);
|
147 |
-
var padding = {
|
148 |
-
left: GetValue(config, 'space.contentLeft', 0),
|
149 |
-
right: GetValue(config, 'space.contentRight', 0),
|
150 |
-
bottom: ((description || choices || actions) ? contentSpace : 0)
|
151 |
-
}
|
152 |
-
var proportion = GetValue(config, 'proportion.content', 0);
|
153 |
-
var expand = GetValue(config, 'expand.content', true);
|
154 |
-
this.add(
|
155 |
-
content,
|
156 |
-
{ align: align, padding: padding, proportion: proportion, expand: expand }
|
157 |
-
);
|
158 |
-
}
|
159 |
-
|
160 |
-
if (description) {
|
161 |
-
var align = GetValue(config, 'align.description', 'center');
|
162 |
-
var descriptionSpace = GetValue(config, 'space.description', 0);
|
163 |
-
var padding = {
|
164 |
-
left: GetValue(config, 'space.descriptionLeft', 0),
|
165 |
-
right: GetValue(config, 'space.descriptionRight', 0),
|
166 |
-
bottom: ((choices || actions) ? descriptionSpace : 0)
|
167 |
-
}
|
168 |
-
var proportion = GetValue(config, 'proportion.description', 0);
|
169 |
-
var expand = GetValue(config, 'expand.description', true);
|
170 |
-
this.add(
|
171 |
-
description,
|
172 |
-
{ align: align, padding: padding, proportion: proportion, expand: expand }
|
173 |
-
);
|
174 |
-
}
|
175 |
-
|
176 |
-
if (choices) {
|
177 |
-
var choicesType = GetValue(config, 'choicesType', '').split('-');
|
178 |
-
var ButtonsClass = Contains(choicesType, 'wrap') ? FixWidthButtons :
|
179 |
-
Contains(choicesType, 'grid') ? GridButtons :
|
180 |
-
Buttons;
|
181 |
-
var buttonsType = Contains(choicesType, 'radio') ? 'radio' :
|
182 |
-
Contains(choicesType, 'checkboxes') ? 'checkboxes' : undefined;
|
183 |
-
|
184 |
-
var space = {
|
185 |
-
left: GetValue(config, 'space.choicesBackgroundLeft', 0),
|
186 |
-
right: GetValue(config, 'space.choicesBackgroundRight', 0),
|
187 |
-
top: GetValue(config, 'space.choicesBackgroundTop', 0),
|
188 |
-
bottom: GetValue(config, 'space.choicesBackgroundBottom', 0),
|
189 |
-
};
|
190 |
-
var itemSpace = GetValue(config, 'space.choice', 0);
|
191 |
-
if (ButtonsClass === Buttons) {
|
192 |
-
space.item = itemSpace;
|
193 |
-
} else if (ButtonsClass === FixWidthButtons) {
|
194 |
-
space.item = itemSpace;
|
195 |
-
space.line = GetValue(config, 'space.choiceLine', itemSpace);
|
196 |
-
} else { // GridButtons
|
197 |
-
space.column = GetValue(config, 'space.choiceColumn', itemSpace);
|
198 |
-
space.row = GetValue(config, 'space.choiceRow', itemSpace);
|
199 |
-
}
|
200 |
-
|
201 |
-
var choicesConfig = {
|
202 |
-
width: GetValue(config, 'choicesWidth', undefined),
|
203 |
-
height: GetValue(config, 'choicesHeight', undefined),
|
204 |
-
groupName: 'choices',
|
205 |
-
buttonsType: buttonsType,
|
206 |
-
background: choicesBackground,
|
207 |
-
buttons: choices,
|
208 |
-
space: space,
|
209 |
-
click: clickConfig,
|
210 |
-
eventEmitter: this.eventEmitter,
|
211 |
-
setValueCallback: GetValue(config, 'choicesSetValueCallback', undefined),
|
212 |
-
setValueCallbackScope: GetValue(config, 'choicesSetValueCallbackScope', undefined)
|
213 |
-
};
|
214 |
-
|
215 |
-
if (ButtonsClass === Buttons) {
|
216 |
-
choicesConfig.orientation = Contains(choicesType, 'x') ? 0 : 1;
|
217 |
-
}
|
218 |
-
|
219 |
-
choicesSizer = new ButtonsClass(scene, choicesConfig);
|
220 |
-
var choicesSpace = GetValue(config, 'space.choices', 0);
|
221 |
-
var padding = {
|
222 |
-
left: GetValue(config, 'space.choicesLeft', 0),
|
223 |
-
right: GetValue(config, 'space.choicesRight', 0),
|
224 |
-
bottom: ((actions) ? choicesSpace : 0)
|
225 |
-
}
|
226 |
-
var align = GetValue(config, 'align.choices', 'center');
|
227 |
-
var proportion = GetValue(config, 'proportion.choices', 0);
|
228 |
-
var expand = GetValue(config, 'expand.choices', true);
|
229 |
-
this.add(
|
230 |
-
choicesSizer,
|
231 |
-
{ align: align, padding: padding, proportion: proportion, expand: expand }
|
232 |
-
);
|
233 |
-
|
234 |
-
this.buttonsType = buttonsType;
|
235 |
-
}
|
236 |
-
|
237 |
-
if (actions) {
|
238 |
-
actionsSizer = new Buttons(scene, {
|
239 |
-
groupName: 'actions',
|
240 |
-
background: actionsBackground,
|
241 |
-
buttons: actions,
|
242 |
-
orientation: 0, // Left-right
|
243 |
-
space: { item: GetValue(config, 'space.action', 0) },
|
244 |
-
expand: GetValue(config, 'expand.actions', false),
|
245 |
-
align: GetValue(config, 'align.actions', 'center'),
|
246 |
-
click: clickConfig,
|
247 |
-
eventEmitter: this.eventEmitter,
|
248 |
-
})
|
249 |
-
var padding = {
|
250 |
-
left: GetValue(config, 'space.actionsLeft', 0),
|
251 |
-
right: GetValue(config, 'space.actionsRight', 0)
|
252 |
-
}
|
253 |
-
var proportion = GetValue(config, 'proportion.action', 0);
|
254 |
-
this.add(
|
255 |
-
actionsSizer,
|
256 |
-
{ align: 'center', padding: padding, proportion: proportion, expand: true }
|
257 |
-
);
|
258 |
-
}
|
259 |
-
|
260 |
-
EmitButtonEvent(this, 'click');
|
261 |
-
EmitButtonEvent(this, 'over');
|
262 |
-
EmitButtonEvent(this, 'out');
|
263 |
-
EmitButtonEvent(this, 'enable');
|
264 |
-
EmitButtonEvent(this, 'disable');
|
265 |
-
|
266 |
-
this.addChildrenMap('background', background);
|
267 |
-
this.addChildrenMap('title', title);
|
268 |
-
this.addChildrenMap('toolbar', toolbar);
|
269 |
-
this.addChildrenMap('leftToolbar', leftToolbar);
|
270 |
-
this.addChildrenMap('content', content);
|
271 |
-
this.addChildrenMap('description', description);
|
272 |
-
this.addChildrenMap('choices', (choicesSizer) ? choicesSizer.buttons : undefined);
|
273 |
-
this.addChildrenMap('actions', (actionsSizer) ? actionsSizer.buttons : undefined);
|
274 |
-
this.addChildrenMap('choicesSizer', choicesSizer);
|
275 |
-
this.addChildrenMap('actionsSizer', actionsSizer);
|
276 |
-
this.addChildrenMap('toolbarSizer', toolbarSizer);
|
277 |
-
this.addChildrenMap('leftToolbarSizer', leftToolbarSizer);
|
278 |
-
}
|
279 |
-
}
|
280 |
-
|
281 |
-
var Contains = function (arr, item) {
|
282 |
-
return arr.indexOf(item) !== -1;
|
283 |
-
}
|
284 |
-
|
285 |
-
var ButtonsGroupEventNameMap = {
|
286 |
-
actions: 'action',
|
287 |
-
choices: 'choice',
|
288 |
-
toolbar: 'toolbar',
|
289 |
-
leftToolbar: 'leftToolbar'
|
290 |
-
}
|
291 |
-
|
292 |
-
var EmitButtonEvent = function (dialog, postEventName) {
|
293 |
-
dialog.on(`button.${postEventName}`, function (button, groupName, index, pointer, event) {
|
294 |
-
if (!ButtonsGroupEventNameMap.hasOwnProperty(groupName)) {
|
295 |
-
return
|
296 |
-
}
|
297 |
-
dialog.emit(`${ButtonsGroupEventNameMap[groupName]}.${postEventName}`, button, index, pointer, event);
|
298 |
-
})
|
299 |
-
}
|
300 |
-
|
301 |
-
Object.assign(
|
302 |
-
Dialog.prototype,
|
303 |
-
Methods
|
304 |
-
);
|
305 |
-
|
306 |
-
export default Dialog;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Ahmedmewloud/Depplearnig/Makefile
DELETED
@@ -1,28 +0,0 @@
|
|
1 |
-
install:
|
2 |
-
pip install --upgrade pip &&\
|
3 |
-
pip install -r requirements.txt
|
4 |
-
|
5 |
-
test:
|
6 |
-
python -m pytest -vvv --cov=hello --cov=greeting \
|
7 |
-
--cov=smath --cov=web tests
|
8 |
-
python -m pytest --nbval notebook.ipynb #tests our jupyter notebook
|
9 |
-
#python -m pytest -v tests/test_web.py #if you just want to test web
|
10 |
-
|
11 |
-
debug:
|
12 |
-
python -m pytest -vv --pdb #Debugger is invoked
|
13 |
-
|
14 |
-
one-test:
|
15 |
-
python -m pytest -vv tests/test_greeting.py::test_my_name4
|
16 |
-
|
17 |
-
debugthree:
|
18 |
-
#not working the way I expect
|
19 |
-
python -m pytest -vv --pdb --maxfail=4 # drop to PDB for first three failures
|
20 |
-
|
21 |
-
format:
|
22 |
-
black *.py
|
23 |
-
|
24 |
-
lint:
|
25 |
-
pylint --disable=R,C *.py
|
26 |
-
|
27 |
-
all: install lint test format
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/AiPalsDev/Translate_It/README.md
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
---
|
2 |
-
title: Translate It
|
3 |
-
emoji: 🔥
|
4 |
-
colorFrom: purple
|
5 |
-
colorTo: pink
|
6 |
-
sdk: gradio
|
7 |
-
sdk_version: 3.24.1
|
8 |
-
app_file: app.py
|
9 |
-
pinned: false
|
10 |
-
license: apache-2.0
|
11 |
-
---
|
12 |
-
|
13 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Ajaymaurya1008/meme-identifier/README.md
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
---
|
2 |
-
title: Hrishikesh332 Autotrain Meme Classification 42897109437
|
3 |
-
emoji: 😻
|
4 |
-
colorFrom: pink
|
5 |
-
colorTo: pink
|
6 |
-
sdk: streamlit
|
7 |
-
sdk_version: 1.17.0
|
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/Alpaca233/SadTalker/src/face3d/options/inference_options.py
DELETED
@@ -1,23 +0,0 @@
|
|
1 |
-
from face3d.options.base_options import BaseOptions
|
2 |
-
|
3 |
-
|
4 |
-
class InferenceOptions(BaseOptions):
|
5 |
-
"""This class includes test options.
|
6 |
-
|
7 |
-
It also includes shared options defined in BaseOptions.
|
8 |
-
"""
|
9 |
-
|
10 |
-
def initialize(self, parser):
|
11 |
-
parser = BaseOptions.initialize(self, parser) # define shared options
|
12 |
-
parser.add_argument('--phase', type=str, default='test', help='train, val, test, etc')
|
13 |
-
parser.add_argument('--dataset_mode', type=str, default=None, help='chooses how datasets are loaded. [None | flist]')
|
14 |
-
|
15 |
-
parser.add_argument('--input_dir', type=str, help='the folder of the input files')
|
16 |
-
parser.add_argument('--keypoint_dir', type=str, help='the folder of the keypoint files')
|
17 |
-
parser.add_argument('--output_dir', type=str, default='mp4', help='the output dir to save the extracted coefficients')
|
18 |
-
parser.add_argument('--save_split_files', action='store_true', help='save split files or not')
|
19 |
-
parser.add_argument('--inference_batch_size', type=int, default=8)
|
20 |
-
|
21 |
-
# Dropout and Batchnorm has different behavior during training and test.
|
22 |
-
self.isTrain = False
|
23 |
-
return parser
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/examples/research_projects/README.md
DELETED
@@ -1,14 +0,0 @@
|
|
1 |
-
# Research projects
|
2 |
-
|
3 |
-
This folder contains various research projects using 🧨 Diffusers.
|
4 |
-
They are not really maintained by the core maintainers of this library and often require a specific version of Diffusers that is indicated in the requirements file of each folder.
|
5 |
-
Updating them to the most recent version of the library will require some work.
|
6 |
-
|
7 |
-
To use any of them, just run the command
|
8 |
-
|
9 |
-
```
|
10 |
-
pip install -r requirements.txt
|
11 |
-
```
|
12 |
-
inside the folder of your choice.
|
13 |
-
|
14 |
-
If you need help with any of those, please open an issue where you directly ping the author(s), as indicated at the top of the README of each folder.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/scripts/conversion_ldm_uncond.py
DELETED
@@ -1,56 +0,0 @@
|
|
1 |
-
import argparse
|
2 |
-
|
3 |
-
import OmegaConf
|
4 |
-
import torch
|
5 |
-
|
6 |
-
from diffusers import DDIMScheduler, LDMPipeline, UNetLDMModel, VQModel
|
7 |
-
|
8 |
-
|
9 |
-
def convert_ldm_original(checkpoint_path, config_path, output_path):
|
10 |
-
config = OmegaConf.load(config_path)
|
11 |
-
state_dict = torch.load(checkpoint_path, map_location="cpu")["model"]
|
12 |
-
keys = list(state_dict.keys())
|
13 |
-
|
14 |
-
# extract state_dict for VQVAE
|
15 |
-
first_stage_dict = {}
|
16 |
-
first_stage_key = "first_stage_model."
|
17 |
-
for key in keys:
|
18 |
-
if key.startswith(first_stage_key):
|
19 |
-
first_stage_dict[key.replace(first_stage_key, "")] = state_dict[key]
|
20 |
-
|
21 |
-
# extract state_dict for UNetLDM
|
22 |
-
unet_state_dict = {}
|
23 |
-
unet_key = "model.diffusion_model."
|
24 |
-
for key in keys:
|
25 |
-
if key.startswith(unet_key):
|
26 |
-
unet_state_dict[key.replace(unet_key, "")] = state_dict[key]
|
27 |
-
|
28 |
-
vqvae_init_args = config.model.params.first_stage_config.params
|
29 |
-
unet_init_args = config.model.params.unet_config.params
|
30 |
-
|
31 |
-
vqvae = VQModel(**vqvae_init_args).eval()
|
32 |
-
vqvae.load_state_dict(first_stage_dict)
|
33 |
-
|
34 |
-
unet = UNetLDMModel(**unet_init_args).eval()
|
35 |
-
unet.load_state_dict(unet_state_dict)
|
36 |
-
|
37 |
-
noise_scheduler = DDIMScheduler(
|
38 |
-
timesteps=config.model.params.timesteps,
|
39 |
-
beta_schedule="scaled_linear",
|
40 |
-
beta_start=config.model.params.linear_start,
|
41 |
-
beta_end=config.model.params.linear_end,
|
42 |
-
clip_sample=False,
|
43 |
-
)
|
44 |
-
|
45 |
-
pipeline = LDMPipeline(vqvae, unet, noise_scheduler)
|
46 |
-
pipeline.save_pretrained(output_path)
|
47 |
-
|
48 |
-
|
49 |
-
if __name__ == "__main__":
|
50 |
-
parser = argparse.ArgumentParser()
|
51 |
-
parser.add_argument("--checkpoint_path", type=str, required=True)
|
52 |
-
parser.add_argument("--config_path", type=str, required=True)
|
53 |
-
parser.add_argument("--output_path", type=str, required=True)
|
54 |
-
args = parser.parse_args()
|
55 |
-
|
56 |
-
convert_ldm_original(args.checkpoint_path, args.config_path, args.output_path)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Andy1621/uniformer_image_detection/configs/res2net/cascade_mask_rcnn_r2_101_fpn_20e_coco.py
DELETED
@@ -1,4 +0,0 @@
|
|
1 |
-
_base_ = '../cascade_rcnn/cascade_mask_rcnn_r50_fpn_20e_coco.py'
|
2 |
-
model = dict(
|
3 |
-
pretrained='open-mmlab://res2net101_v1d_26w_4s',
|
4 |
-
backbone=dict(type='Res2Net', depth=101, scales=4, base_width=26))
|
|
|
|
|
|
|
|
|
|
spaces/Andy1621/uniformer_image_detection/configs/tridentnet/tridentnet_r50_caffe_1x_coco.py
DELETED
@@ -1,53 +0,0 @@
|
|
1 |
-
_base_ = [
|
2 |
-
'../_base_/models/faster_rcnn_r50_caffe_c4.py',
|
3 |
-
'../_base_/datasets/coco_detection.py',
|
4 |
-
'../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'
|
5 |
-
]
|
6 |
-
|
7 |
-
model = dict(
|
8 |
-
type='TridentFasterRCNN',
|
9 |
-
pretrained='open-mmlab://detectron2/resnet50_caffe',
|
10 |
-
backbone=dict(
|
11 |
-
type='TridentResNet',
|
12 |
-
trident_dilations=(1, 2, 3),
|
13 |
-
num_branch=3,
|
14 |
-
test_branch_idx=1),
|
15 |
-
roi_head=dict(type='TridentRoIHead', num_branch=3, test_branch_idx=1),
|
16 |
-
train_cfg=dict(
|
17 |
-
rpn_proposal=dict(max_per_img=500),
|
18 |
-
rcnn=dict(
|
19 |
-
sampler=dict(num=128, pos_fraction=0.5,
|
20 |
-
add_gt_as_proposals=False))))
|
21 |
-
|
22 |
-
# use caffe img_norm
|
23 |
-
img_norm_cfg = dict(
|
24 |
-
mean=[103.530, 116.280, 123.675], std=[1.0, 1.0, 1.0], to_rgb=False)
|
25 |
-
train_pipeline = [
|
26 |
-
dict(type='LoadImageFromFile'),
|
27 |
-
dict(type='LoadAnnotations', with_bbox=True),
|
28 |
-
dict(type='Resize', img_scale=(1333, 800), keep_ratio=True),
|
29 |
-
dict(type='RandomFlip', flip_ratio=0.5),
|
30 |
-
dict(type='Normalize', **img_norm_cfg),
|
31 |
-
dict(type='Pad', size_divisor=32),
|
32 |
-
dict(type='DefaultFormatBundle'),
|
33 |
-
dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels'])
|
34 |
-
]
|
35 |
-
test_pipeline = [
|
36 |
-
dict(type='LoadImageFromFile'),
|
37 |
-
dict(
|
38 |
-
type='MultiScaleFlipAug',
|
39 |
-
img_scale=(1333, 800),
|
40 |
-
flip=False,
|
41 |
-
transforms=[
|
42 |
-
dict(type='Resize', keep_ratio=True),
|
43 |
-
dict(type='RandomFlip'),
|
44 |
-
dict(type='Normalize', **img_norm_cfg),
|
45 |
-
dict(type='Pad', size_divisor=32),
|
46 |
-
dict(type='ImageToTensor', keys=['img']),
|
47 |
-
dict(type='Collect', keys=['img'])
|
48 |
-
])
|
49 |
-
]
|
50 |
-
data = dict(
|
51 |
-
train=dict(pipeline=train_pipeline),
|
52 |
-
val=dict(pipeline=test_pipeline),
|
53 |
-
test=dict(pipeline=test_pipeline))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Andy1621/uniformer_image_segmentation/README.md
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
---
|
2 |
-
title: Uniformer_image_segmentation
|
3 |
-
emoji: ⚡
|
4 |
-
colorFrom: blue
|
5 |
-
colorTo: pink
|
6 |
-
sdk: gradio
|
7 |
-
sdk_version: 3.0.4
|
8 |
-
app_file: app.py
|
9 |
-
pinned: false
|
10 |
-
license: mit
|
11 |
-
---
|
12 |
-
|
13 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces#reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/pip/_internal/utils/egg_link.py
DELETED
@@ -1,72 +0,0 @@
|
|
1 |
-
import os
|
2 |
-
import re
|
3 |
-
import sys
|
4 |
-
from typing import List, Optional
|
5 |
-
|
6 |
-
from pip._internal.locations import site_packages, user_site
|
7 |
-
from pip._internal.utils.virtualenv import (
|
8 |
-
running_under_virtualenv,
|
9 |
-
virtualenv_no_global,
|
10 |
-
)
|
11 |
-
|
12 |
-
__all__ = [
|
13 |
-
"egg_link_path_from_sys_path",
|
14 |
-
"egg_link_path_from_location",
|
15 |
-
]
|
16 |
-
|
17 |
-
|
18 |
-
def _egg_link_name(raw_name: str) -> str:
|
19 |
-
"""
|
20 |
-
Convert a Name metadata value to a .egg-link name, by applying
|
21 |
-
the same substitution as pkg_resources's safe_name function.
|
22 |
-
Note: we cannot use canonicalize_name because it has a different logic.
|
23 |
-
"""
|
24 |
-
return re.sub("[^A-Za-z0-9.]+", "-", raw_name) + ".egg-link"
|
25 |
-
|
26 |
-
|
27 |
-
def egg_link_path_from_sys_path(raw_name: str) -> Optional[str]:
|
28 |
-
"""
|
29 |
-
Look for a .egg-link file for project name, by walking sys.path.
|
30 |
-
"""
|
31 |
-
egg_link_name = _egg_link_name(raw_name)
|
32 |
-
for path_item in sys.path:
|
33 |
-
egg_link = os.path.join(path_item, egg_link_name)
|
34 |
-
if os.path.isfile(egg_link):
|
35 |
-
return egg_link
|
36 |
-
return None
|
37 |
-
|
38 |
-
|
39 |
-
def egg_link_path_from_location(raw_name: str) -> Optional[str]:
|
40 |
-
"""
|
41 |
-
Return the path for the .egg-link file if it exists, otherwise, None.
|
42 |
-
|
43 |
-
There's 3 scenarios:
|
44 |
-
1) not in a virtualenv
|
45 |
-
try to find in site.USER_SITE, then site_packages
|
46 |
-
2) in a no-global virtualenv
|
47 |
-
try to find in site_packages
|
48 |
-
3) in a yes-global virtualenv
|
49 |
-
try to find in site_packages, then site.USER_SITE
|
50 |
-
(don't look in global location)
|
51 |
-
|
52 |
-
For #1 and #3, there could be odd cases, where there's an egg-link in 2
|
53 |
-
locations.
|
54 |
-
|
55 |
-
This method will just return the first one found.
|
56 |
-
"""
|
57 |
-
sites: List[str] = []
|
58 |
-
if running_under_virtualenv():
|
59 |
-
sites.append(site_packages)
|
60 |
-
if not virtualenv_no_global() and user_site:
|
61 |
-
sites.append(user_site)
|
62 |
-
else:
|
63 |
-
if user_site:
|
64 |
-
sites.append(user_site)
|
65 |
-
sites.append(site_packages)
|
66 |
-
|
67 |
-
egg_link_name = _egg_link_name(raw_name)
|
68 |
-
for site in sites:
|
69 |
-
egglink = os.path.join(site, egg_link_name)
|
70 |
-
if os.path.isfile(egglink):
|
71 |
-
return egglink
|
72 |
-
return None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/pip/_vendor/rich/_null_file.py
DELETED
@@ -1,69 +0,0 @@
|
|
1 |
-
from types import TracebackType
|
2 |
-
from typing import IO, Iterable, Iterator, List, Optional, Type
|
3 |
-
|
4 |
-
|
5 |
-
class NullFile(IO[str]):
|
6 |
-
def close(self) -> None:
|
7 |
-
pass
|
8 |
-
|
9 |
-
def isatty(self) -> bool:
|
10 |
-
return False
|
11 |
-
|
12 |
-
def read(self, __n: int = 1) -> str:
|
13 |
-
return ""
|
14 |
-
|
15 |
-
def readable(self) -> bool:
|
16 |
-
return False
|
17 |
-
|
18 |
-
def readline(self, __limit: int = 1) -> str:
|
19 |
-
return ""
|
20 |
-
|
21 |
-
def readlines(self, __hint: int = 1) -> List[str]:
|
22 |
-
return []
|
23 |
-
|
24 |
-
def seek(self, __offset: int, __whence: int = 1) -> int:
|
25 |
-
return 0
|
26 |
-
|
27 |
-
def seekable(self) -> bool:
|
28 |
-
return False
|
29 |
-
|
30 |
-
def tell(self) -> int:
|
31 |
-
return 0
|
32 |
-
|
33 |
-
def truncate(self, __size: Optional[int] = 1) -> int:
|
34 |
-
return 0
|
35 |
-
|
36 |
-
def writable(self) -> bool:
|
37 |
-
return False
|
38 |
-
|
39 |
-
def writelines(self, __lines: Iterable[str]) -> None:
|
40 |
-
pass
|
41 |
-
|
42 |
-
def __next__(self) -> str:
|
43 |
-
return ""
|
44 |
-
|
45 |
-
def __iter__(self) -> Iterator[str]:
|
46 |
-
return iter([""])
|
47 |
-
|
48 |
-
def __enter__(self) -> IO[str]:
|
49 |
-
pass
|
50 |
-
|
51 |
-
def __exit__(
|
52 |
-
self,
|
53 |
-
__t: Optional[Type[BaseException]],
|
54 |
-
__value: Optional[BaseException],
|
55 |
-
__traceback: Optional[TracebackType],
|
56 |
-
) -> None:
|
57 |
-
pass
|
58 |
-
|
59 |
-
def write(self, text: str) -> int:
|
60 |
-
return 0
|
61 |
-
|
62 |
-
def flush(self) -> None:
|
63 |
-
pass
|
64 |
-
|
65 |
-
def fileno(self) -> int:
|
66 |
-
return -1
|
67 |
-
|
68 |
-
|
69 |
-
NULL_FILE = NullFile()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/setuptools/command/build_ext.py
DELETED
@@ -1,383 +0,0 @@
|
|
1 |
-
import os
|
2 |
-
import sys
|
3 |
-
import itertools
|
4 |
-
from importlib.machinery import EXTENSION_SUFFIXES
|
5 |
-
from importlib.util import cache_from_source as _compiled_file_name
|
6 |
-
from typing import Dict, Iterator, List, Tuple
|
7 |
-
|
8 |
-
from distutils.command.build_ext import build_ext as _du_build_ext
|
9 |
-
from distutils.ccompiler import new_compiler
|
10 |
-
from distutils.sysconfig import customize_compiler, get_config_var
|
11 |
-
from distutils import log
|
12 |
-
|
13 |
-
from setuptools.errors import BaseError
|
14 |
-
from setuptools.extension import Extension, Library
|
15 |
-
|
16 |
-
try:
|
17 |
-
# Attempt to use Cython for building extensions, if available
|
18 |
-
from Cython.Distutils.build_ext import build_ext as _build_ext
|
19 |
-
# Additionally, assert that the compiler module will load
|
20 |
-
# also. Ref #1229.
|
21 |
-
__import__('Cython.Compiler.Main')
|
22 |
-
except ImportError:
|
23 |
-
_build_ext = _du_build_ext
|
24 |
-
|
25 |
-
# make sure _config_vars is initialized
|
26 |
-
get_config_var("LDSHARED")
|
27 |
-
from distutils.sysconfig import _config_vars as _CONFIG_VARS # noqa
|
28 |
-
|
29 |
-
|
30 |
-
def _customize_compiler_for_shlib(compiler):
|
31 |
-
if sys.platform == "darwin":
|
32 |
-
# building .dylib requires additional compiler flags on OSX; here we
|
33 |
-
# temporarily substitute the pyconfig.h variables so that distutils'
|
34 |
-
# 'customize_compiler' uses them before we build the shared libraries.
|
35 |
-
tmp = _CONFIG_VARS.copy()
|
36 |
-
try:
|
37 |
-
# XXX Help! I don't have any idea whether these are right...
|
38 |
-
_CONFIG_VARS['LDSHARED'] = (
|
39 |
-
"gcc -Wl,-x -dynamiclib -undefined dynamic_lookup")
|
40 |
-
_CONFIG_VARS['CCSHARED'] = " -dynamiclib"
|
41 |
-
_CONFIG_VARS['SO'] = ".dylib"
|
42 |
-
customize_compiler(compiler)
|
43 |
-
finally:
|
44 |
-
_CONFIG_VARS.clear()
|
45 |
-
_CONFIG_VARS.update(tmp)
|
46 |
-
else:
|
47 |
-
customize_compiler(compiler)
|
48 |
-
|
49 |
-
|
50 |
-
have_rtld = False
|
51 |
-
use_stubs = False
|
52 |
-
libtype = 'shared'
|
53 |
-
|
54 |
-
if sys.platform == "darwin":
|
55 |
-
use_stubs = True
|
56 |
-
elif os.name != 'nt':
|
57 |
-
try:
|
58 |
-
import dl
|
59 |
-
use_stubs = have_rtld = hasattr(dl, 'RTLD_NOW')
|
60 |
-
except ImportError:
|
61 |
-
pass
|
62 |
-
|
63 |
-
|
64 |
-
def if_dl(s):
|
65 |
-
return s if have_rtld else ''
|
66 |
-
|
67 |
-
|
68 |
-
def get_abi3_suffix():
|
69 |
-
"""Return the file extension for an abi3-compliant Extension()"""
|
70 |
-
for suffix in EXTENSION_SUFFIXES:
|
71 |
-
if '.abi3' in suffix: # Unix
|
72 |
-
return suffix
|
73 |
-
elif suffix == '.pyd': # Windows
|
74 |
-
return suffix
|
75 |
-
|
76 |
-
|
77 |
-
class build_ext(_build_ext):
|
78 |
-
editable_mode: bool = False
|
79 |
-
inplace: bool = False
|
80 |
-
|
81 |
-
def run(self):
|
82 |
-
"""Build extensions in build directory, then copy if --inplace"""
|
83 |
-
old_inplace, self.inplace = self.inplace, 0
|
84 |
-
_build_ext.run(self)
|
85 |
-
self.inplace = old_inplace
|
86 |
-
if old_inplace:
|
87 |
-
self.copy_extensions_to_source()
|
88 |
-
|
89 |
-
def _get_inplace_equivalent(self, build_py, ext: Extension) -> Tuple[str, str]:
|
90 |
-
fullname = self.get_ext_fullname(ext.name)
|
91 |
-
filename = self.get_ext_filename(fullname)
|
92 |
-
modpath = fullname.split('.')
|
93 |
-
package = '.'.join(modpath[:-1])
|
94 |
-
package_dir = build_py.get_package_dir(package)
|
95 |
-
inplace_file = os.path.join(package_dir, os.path.basename(filename))
|
96 |
-
regular_file = os.path.join(self.build_lib, filename)
|
97 |
-
return (inplace_file, regular_file)
|
98 |
-
|
99 |
-
def copy_extensions_to_source(self):
|
100 |
-
build_py = self.get_finalized_command('build_py')
|
101 |
-
for ext in self.extensions:
|
102 |
-
inplace_file, regular_file = self._get_inplace_equivalent(build_py, ext)
|
103 |
-
|
104 |
-
# Always copy, even if source is older than destination, to ensure
|
105 |
-
# that the right extensions for the current Python/platform are
|
106 |
-
# used.
|
107 |
-
if os.path.exists(regular_file) or not ext.optional:
|
108 |
-
self.copy_file(regular_file, inplace_file, level=self.verbose)
|
109 |
-
|
110 |
-
if ext._needs_stub:
|
111 |
-
inplace_stub = self._get_equivalent_stub(ext, inplace_file)
|
112 |
-
self._write_stub_file(inplace_stub, ext, compile=True)
|
113 |
-
# Always compile stub and remove the original (leave the cache behind)
|
114 |
-
# (this behaviour was observed in previous iterations of the code)
|
115 |
-
|
116 |
-
def _get_equivalent_stub(self, ext: Extension, output_file: str) -> str:
|
117 |
-
dir_ = os.path.dirname(output_file)
|
118 |
-
_, _, name = ext.name.rpartition(".")
|
119 |
-
return f"{os.path.join(dir_, name)}.py"
|
120 |
-
|
121 |
-
def _get_output_mapping(self) -> Iterator[Tuple[str, str]]:
|
122 |
-
if not self.inplace:
|
123 |
-
return
|
124 |
-
|
125 |
-
build_py = self.get_finalized_command('build_py')
|
126 |
-
opt = self.get_finalized_command('install_lib').optimize or ""
|
127 |
-
|
128 |
-
for ext in self.extensions:
|
129 |
-
inplace_file, regular_file = self._get_inplace_equivalent(build_py, ext)
|
130 |
-
yield (regular_file, inplace_file)
|
131 |
-
|
132 |
-
if ext._needs_stub:
|
133 |
-
# This version of `build_ext` always builds artifacts in another dir,
|
134 |
-
# when "inplace=True" is given it just copies them back.
|
135 |
-
# This is done in the `copy_extensions_to_source` function, which
|
136 |
-
# always compile stub files via `_compile_and_remove_stub`.
|
137 |
-
# At the end of the process, a `.pyc` stub file is created without the
|
138 |
-
# corresponding `.py`.
|
139 |
-
|
140 |
-
inplace_stub = self._get_equivalent_stub(ext, inplace_file)
|
141 |
-
regular_stub = self._get_equivalent_stub(ext, regular_file)
|
142 |
-
inplace_cache = _compiled_file_name(inplace_stub, optimization=opt)
|
143 |
-
output_cache = _compiled_file_name(regular_stub, optimization=opt)
|
144 |
-
yield (output_cache, inplace_cache)
|
145 |
-
|
146 |
-
def get_ext_filename(self, fullname):
|
147 |
-
so_ext = os.getenv('SETUPTOOLS_EXT_SUFFIX')
|
148 |
-
if so_ext:
|
149 |
-
filename = os.path.join(*fullname.split('.')) + so_ext
|
150 |
-
else:
|
151 |
-
filename = _build_ext.get_ext_filename(self, fullname)
|
152 |
-
so_ext = get_config_var('EXT_SUFFIX')
|
153 |
-
|
154 |
-
if fullname in self.ext_map:
|
155 |
-
ext = self.ext_map[fullname]
|
156 |
-
use_abi3 = getattr(ext, 'py_limited_api') and get_abi3_suffix()
|
157 |
-
if use_abi3:
|
158 |
-
filename = filename[:-len(so_ext)]
|
159 |
-
so_ext = get_abi3_suffix()
|
160 |
-
filename = filename + so_ext
|
161 |
-
if isinstance(ext, Library):
|
162 |
-
fn, ext = os.path.splitext(filename)
|
163 |
-
return self.shlib_compiler.library_filename(fn, libtype)
|
164 |
-
elif use_stubs and ext._links_to_dynamic:
|
165 |
-
d, fn = os.path.split(filename)
|
166 |
-
return os.path.join(d, 'dl-' + fn)
|
167 |
-
return filename
|
168 |
-
|
169 |
-
def initialize_options(self):
|
170 |
-
_build_ext.initialize_options(self)
|
171 |
-
self.shlib_compiler = None
|
172 |
-
self.shlibs = []
|
173 |
-
self.ext_map = {}
|
174 |
-
self.editable_mode = False
|
175 |
-
|
176 |
-
def finalize_options(self):
|
177 |
-
_build_ext.finalize_options(self)
|
178 |
-
self.extensions = self.extensions or []
|
179 |
-
self.check_extensions_list(self.extensions)
|
180 |
-
self.shlibs = [ext for ext in self.extensions
|
181 |
-
if isinstance(ext, Library)]
|
182 |
-
if self.shlibs:
|
183 |
-
self.setup_shlib_compiler()
|
184 |
-
for ext in self.extensions:
|
185 |
-
ext._full_name = self.get_ext_fullname(ext.name)
|
186 |
-
for ext in self.extensions:
|
187 |
-
fullname = ext._full_name
|
188 |
-
self.ext_map[fullname] = ext
|
189 |
-
|
190 |
-
# distutils 3.1 will also ask for module names
|
191 |
-
# XXX what to do with conflicts?
|
192 |
-
self.ext_map[fullname.split('.')[-1]] = ext
|
193 |
-
|
194 |
-
ltd = self.shlibs and self.links_to_dynamic(ext) or False
|
195 |
-
ns = ltd and use_stubs and not isinstance(ext, Library)
|
196 |
-
ext._links_to_dynamic = ltd
|
197 |
-
ext._needs_stub = ns
|
198 |
-
filename = ext._file_name = self.get_ext_filename(fullname)
|
199 |
-
libdir = os.path.dirname(os.path.join(self.build_lib, filename))
|
200 |
-
if ltd and libdir not in ext.library_dirs:
|
201 |
-
ext.library_dirs.append(libdir)
|
202 |
-
if ltd and use_stubs and os.curdir not in ext.runtime_library_dirs:
|
203 |
-
ext.runtime_library_dirs.append(os.curdir)
|
204 |
-
|
205 |
-
if self.editable_mode:
|
206 |
-
self.inplace = True
|
207 |
-
|
208 |
-
def setup_shlib_compiler(self):
|
209 |
-
compiler = self.shlib_compiler = new_compiler(
|
210 |
-
compiler=self.compiler, dry_run=self.dry_run, force=self.force
|
211 |
-
)
|
212 |
-
_customize_compiler_for_shlib(compiler)
|
213 |
-
|
214 |
-
if self.include_dirs is not None:
|
215 |
-
compiler.set_include_dirs(self.include_dirs)
|
216 |
-
if self.define is not None:
|
217 |
-
# 'define' option is a list of (name,value) tuples
|
218 |
-
for (name, value) in self.define:
|
219 |
-
compiler.define_macro(name, value)
|
220 |
-
if self.undef is not None:
|
221 |
-
for macro in self.undef:
|
222 |
-
compiler.undefine_macro(macro)
|
223 |
-
if self.libraries is not None:
|
224 |
-
compiler.set_libraries(self.libraries)
|
225 |
-
if self.library_dirs is not None:
|
226 |
-
compiler.set_library_dirs(self.library_dirs)
|
227 |
-
if self.rpath is not None:
|
228 |
-
compiler.set_runtime_library_dirs(self.rpath)
|
229 |
-
if self.link_objects is not None:
|
230 |
-
compiler.set_link_objects(self.link_objects)
|
231 |
-
|
232 |
-
# hack so distutils' build_extension() builds a library instead
|
233 |
-
compiler.link_shared_object = link_shared_object.__get__(compiler)
|
234 |
-
|
235 |
-
def get_export_symbols(self, ext):
|
236 |
-
if isinstance(ext, Library):
|
237 |
-
return ext.export_symbols
|
238 |
-
return _build_ext.get_export_symbols(self, ext)
|
239 |
-
|
240 |
-
def build_extension(self, ext):
|
241 |
-
ext._convert_pyx_sources_to_lang()
|
242 |
-
_compiler = self.compiler
|
243 |
-
try:
|
244 |
-
if isinstance(ext, Library):
|
245 |
-
self.compiler = self.shlib_compiler
|
246 |
-
_build_ext.build_extension(self, ext)
|
247 |
-
if ext._needs_stub:
|
248 |
-
build_lib = self.get_finalized_command('build_py').build_lib
|
249 |
-
self.write_stub(build_lib, ext)
|
250 |
-
finally:
|
251 |
-
self.compiler = _compiler
|
252 |
-
|
253 |
-
def links_to_dynamic(self, ext):
|
254 |
-
"""Return true if 'ext' links to a dynamic lib in the same package"""
|
255 |
-
# XXX this should check to ensure the lib is actually being built
|
256 |
-
# XXX as dynamic, and not just using a locally-found version or a
|
257 |
-
# XXX static-compiled version
|
258 |
-
libnames = dict.fromkeys([lib._full_name for lib in self.shlibs])
|
259 |
-
pkg = '.'.join(ext._full_name.split('.')[:-1] + [''])
|
260 |
-
return any(pkg + libname in libnames for libname in ext.libraries)
|
261 |
-
|
262 |
-
def get_outputs(self) -> List[str]:
|
263 |
-
if self.inplace:
|
264 |
-
return list(self.get_output_mapping().keys())
|
265 |
-
return sorted(_build_ext.get_outputs(self) + self.__get_stubs_outputs())
|
266 |
-
|
267 |
-
def get_output_mapping(self) -> Dict[str, str]:
|
268 |
-
"""See :class:`setuptools.commands.build.SubCommand`"""
|
269 |
-
mapping = self._get_output_mapping()
|
270 |
-
return dict(sorted(mapping, key=lambda x: x[0]))
|
271 |
-
|
272 |
-
def __get_stubs_outputs(self):
|
273 |
-
# assemble the base name for each extension that needs a stub
|
274 |
-
ns_ext_bases = (
|
275 |
-
os.path.join(self.build_lib, *ext._full_name.split('.'))
|
276 |
-
for ext in self.extensions
|
277 |
-
if ext._needs_stub
|
278 |
-
)
|
279 |
-
# pair each base with the extension
|
280 |
-
pairs = itertools.product(ns_ext_bases, self.__get_output_extensions())
|
281 |
-
return list(base + fnext for base, fnext in pairs)
|
282 |
-
|
283 |
-
def __get_output_extensions(self):
|
284 |
-
yield '.py'
|
285 |
-
yield '.pyc'
|
286 |
-
if self.get_finalized_command('build_py').optimize:
|
287 |
-
yield '.pyo'
|
288 |
-
|
289 |
-
def write_stub(self, output_dir, ext, compile=False):
|
290 |
-
stub_file = os.path.join(output_dir, *ext._full_name.split('.')) + '.py'
|
291 |
-
self._write_stub_file(stub_file, ext, compile)
|
292 |
-
|
293 |
-
def _write_stub_file(self, stub_file: str, ext: Extension, compile=False):
|
294 |
-
log.info("writing stub loader for %s to %s", ext._full_name, stub_file)
|
295 |
-
if compile and os.path.exists(stub_file):
|
296 |
-
raise BaseError(stub_file + " already exists! Please delete.")
|
297 |
-
if not self.dry_run:
|
298 |
-
f = open(stub_file, 'w')
|
299 |
-
f.write(
|
300 |
-
'\n'.join([
|
301 |
-
"def __bootstrap__():",
|
302 |
-
" global __bootstrap__, __file__, __loader__",
|
303 |
-
" import sys, os, pkg_resources, importlib.util" +
|
304 |
-
if_dl(", dl"),
|
305 |
-
" __file__ = pkg_resources.resource_filename"
|
306 |
-
"(__name__,%r)"
|
307 |
-
% os.path.basename(ext._file_name),
|
308 |
-
" del __bootstrap__",
|
309 |
-
" if '__loader__' in globals():",
|
310 |
-
" del __loader__",
|
311 |
-
if_dl(" old_flags = sys.getdlopenflags()"),
|
312 |
-
" old_dir = os.getcwd()",
|
313 |
-
" try:",
|
314 |
-
" os.chdir(os.path.dirname(__file__))",
|
315 |
-
if_dl(" sys.setdlopenflags(dl.RTLD_NOW)"),
|
316 |
-
" spec = importlib.util.spec_from_file_location(",
|
317 |
-
" __name__, __file__)",
|
318 |
-
" mod = importlib.util.module_from_spec(spec)",
|
319 |
-
" spec.loader.exec_module(mod)",
|
320 |
-
" finally:",
|
321 |
-
if_dl(" sys.setdlopenflags(old_flags)"),
|
322 |
-
" os.chdir(old_dir)",
|
323 |
-
"__bootstrap__()",
|
324 |
-
"" # terminal \n
|
325 |
-
])
|
326 |
-
)
|
327 |
-
f.close()
|
328 |
-
if compile:
|
329 |
-
self._compile_and_remove_stub(stub_file)
|
330 |
-
|
331 |
-
def _compile_and_remove_stub(self, stub_file: str):
|
332 |
-
from distutils.util import byte_compile
|
333 |
-
|
334 |
-
byte_compile([stub_file], optimize=0,
|
335 |
-
force=True, dry_run=self.dry_run)
|
336 |
-
optimize = self.get_finalized_command('install_lib').optimize
|
337 |
-
if optimize > 0:
|
338 |
-
byte_compile([stub_file], optimize=optimize,
|
339 |
-
force=True, dry_run=self.dry_run)
|
340 |
-
if os.path.exists(stub_file) and not self.dry_run:
|
341 |
-
os.unlink(stub_file)
|
342 |
-
|
343 |
-
|
344 |
-
if use_stubs or os.name == 'nt':
|
345 |
-
# Build shared libraries
|
346 |
-
#
|
347 |
-
def link_shared_object(
|
348 |
-
self, objects, output_libname, output_dir=None, libraries=None,
|
349 |
-
library_dirs=None, runtime_library_dirs=None, export_symbols=None,
|
350 |
-
debug=0, extra_preargs=None, extra_postargs=None, build_temp=None,
|
351 |
-
target_lang=None):
|
352 |
-
self.link(
|
353 |
-
self.SHARED_LIBRARY, objects, output_libname,
|
354 |
-
output_dir, libraries, library_dirs, runtime_library_dirs,
|
355 |
-
export_symbols, debug, extra_preargs, extra_postargs,
|
356 |
-
build_temp, target_lang
|
357 |
-
)
|
358 |
-
else:
|
359 |
-
# Build static libraries everywhere else
|
360 |
-
libtype = 'static'
|
361 |
-
|
362 |
-
def link_shared_object(
|
363 |
-
self, objects, output_libname, output_dir=None, libraries=None,
|
364 |
-
library_dirs=None, runtime_library_dirs=None, export_symbols=None,
|
365 |
-
debug=0, extra_preargs=None, extra_postargs=None, build_temp=None,
|
366 |
-
target_lang=None):
|
367 |
-
# XXX we need to either disallow these attrs on Library instances,
|
368 |
-
# or warn/abort here if set, or something...
|
369 |
-
# libraries=None, library_dirs=None, runtime_library_dirs=None,
|
370 |
-
# export_symbols=None, extra_preargs=None, extra_postargs=None,
|
371 |
-
# build_temp=None
|
372 |
-
|
373 |
-
assert output_dir is None # distutils build_ext doesn't pass this
|
374 |
-
output_dir, filename = os.path.split(output_libname)
|
375 |
-
basename, ext = os.path.splitext(filename)
|
376 |
-
if self.library_filename("x").startswith('lib'):
|
377 |
-
# strip 'lib' prefix; this is kludgy if some platform uses
|
378 |
-
# a different prefix
|
379 |
-
basename = basename[3:]
|
380 |
-
|
381 |
-
self.create_static_lib(
|
382 |
-
objects, basename, output_dir, debug, target_lang
|
383 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Awiny/Image2Paragraph/models/grit_src/third_party/CenterNet2/configs/common/optim.py
DELETED
@@ -1,15 +0,0 @@
|
|
1 |
-
import torch
|
2 |
-
|
3 |
-
from detectron2.config import LazyCall as L
|
4 |
-
from detectron2.solver.build import get_default_optimizer_params
|
5 |
-
|
6 |
-
SGD = L(torch.optim.SGD)(
|
7 |
-
params=L(get_default_optimizer_params)(
|
8 |
-
# params.model is meant to be set to the model object, before instantiating
|
9 |
-
# the optimizer.
|
10 |
-
weight_decay_norm=0.0
|
11 |
-
),
|
12 |
-
lr=0.02,
|
13 |
-
momentum=0.9,
|
14 |
-
weight_decay=1e-4,
|
15 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Benson/text-generation/Examples/Captulo 5 Matemticas Clase 12 Pdf.md
DELETED
@@ -1,183 +0,0 @@
|
|
1 |
-
<br />
|
2 |
-
<h1>Capítulo 5 Matemáticas Clase 12 PDF Descargar</h1>
|
3 |
-
<p>¿Está buscando una manera confiable y fácil de prepararse para su examen de matemáticas CBSE Class 12? ¿Quieres acceder al mejor material de estudio para el Capítulo 5 Continuidad y diferenciabilidad? Si es así, entonces has venido al lugar correcto. En este artículo, te diremos cómo descargar el PDF del Capítulo 5 de la Clase de Matemáticas 12 y por qué es beneficioso para la preparación de tu examen. También le proporcionaremos el plan de estudios, preguntas importantes y soluciones para el capítulo 5 de la clase de matemáticas 12. Así que sigue leyendo y prepárate para aprobar tu examen. </p>
|
4 |
-
<h2>capítulo 5 matemáticas clase 12 pdf</h2><br /><p><b><b>Download</b> ✅ <a href="https://bltlly.com/2v6Ms2">https://bltlly.com/2v6Ms2</a></b></p><br /><br />
|
5 |
-
<h2>Introducción</h2>
|
6 |
-
<p>Capítulo 5 Continuidad y diferenciabilidad es uno de los capítulos más importantes del programa de matemáticas de la clase 12 del CBSE. Se trata de los conceptos de continuidad y diferenciabilidad de funciones, sus propiedades algebraicas, derivadas de compuesto, implícito, trigonométrica inversa, exponencial, y funciones logarítmicas, diferenciación logarítmica, derivadas de funciones en formas paramétricas, derivadas de segundo orden, teorema del valor medio, y el teorema de Rolle. Este capítulo tiene una ponderación de aproximadamente 8 calificaciones en el examen de la junta y también es útil para exámenes competitivos como JEE y NEET.</p>
|
7 |
-
<p>Para dominar este capítulo, necesita entender la teoría, practicar los ejercicios y resolver las preguntas del año anterior. Sin embargo, puede ser difícil llevar todos los libros y notas a todas partes. Es por eso que descargar el PDF del Capítulo 5 Matemáticas Clase 12 es una idea inteligente. Te ayudará a acceder al capítulo en cualquier momento y en cualquier lugar de tu dispositivo. </p>
|
8 |
-
<h3>¿Por qué descargar Capítulo 5 Matemáticas Clase 12 PDF? </h3>
|
9 |
-
<p>Hay muchas razones por las que deberías descargar el PDF del Capítulo 5 de la Clase de Matemáticas 12. Algunas de ellas son:</p>
|
10 |
-
<h4>Beneficios del Capítulo 5 Matemáticas Clase 12 PDF</h4>
|
11 |
-
<ul>
|
12 |
-
<li> Es gratis y fácil de descargar de fuentes confiables como el sitio web NCERT o Vedantu.</li>
|
13 |
-
<li> Es compatible con cualquier dispositivo como portátil, tableta o teléfono inteligente. </li>
|
14 |
-
|
15 |
-
<li> Le ayuda a revisar el capítulo de forma rápida y eficaz. </li>
|
16 |
-
<li>Le proporciona el contenido más reciente y actualizado según el plan de estudios de la CBSE. </li>
|
17 |
-
<li>Mejora tu experiencia de aprendizaje con funciones interactivas como diagramas, gráficos, ejemplos y ejercicios. </li>
|
18 |
-
</ul>
|
19 |
-
<h4> ¿Cómo descargar el Capítulo 5 Matemáticas Clase 12 PDF? </h4>
|
20 |
-
<p>Para descargar el PDF del Capítulo 5 Matemáticas Clase 12, puedes seguir estos sencillos pasos:</p>
|
21 |
-
<ol>
|
22 |
-
<li>Ir al sitio web de NCERT o al sitio web de Vedantu. </li>
|
23 |
-
<li> Seleccione la clase, el tema y el nombre del libro. </li>
|
24 |
-
<li>Haga clic en el nombre del capítulo y ábralo en una nueva pestaña. </li>
|
25 |
-
<li>Haga clic en el botón de descarga o guardar como opción. </li>
|
26 |
-
<li>Elija la ubicación donde desea guardar el archivo. </li>
|
27 |
-
<li>Abre el archivo y empieza a estudiar. </li>
|
28 |
-
</ol>
|
29 |
-
<h2>Capítulo 5 Matemáticas Clase 12 Plan de estudios</h2>
|
30 |
-
<p>Antes de empezar a estudiar el Capítulo 5 Continuidad y diferenciabilidad, debe conocer el plan de estudios de la clase CBSE [asistente](#mensaje) Algunas oraciones adicionales son 12 Matemáticas. El plan de estudios de CBSE clase 12 Matemáticas se divide en seis unidades, a saber, Relaciones y Funciones, Álgebra, Cálculo, Vectores y Geometría Tridimensional, Programación Lineal y Probabilidad. Las calificaciones totales del examen de la junta son 100, de los cuales 80 son para el documento de teoría y 20 son para la evaluación interna. La duración del trabajo teórico es de tres horas. </p>
|
31 |
-
<h3>Resumen del Capítulo 5 Matemáticas Clase 12 Plan de estudios</h3>
|
32 |
-
|
33 |
-
<h4>Distribución de marcas por unidad</h4>
|
34 |
-
<p>La siguiente tabla muestra la distribución de las marcas unitarias para el programa de matemáticas de la clase 12 del CBSE:</p>
|
35 |
-
<p></p>
|
36 |
-
<tabla>
|
37 |
-
<tr>
|
38 |
-
<th>Unidad</th>
|
39 |
-
<th>Marcas</th>
|
40 |
-
</tr>
|
41 |
-
<tr>
|
42 |
-
<td>Relaciones y funciones</td>
|
43 |
-
<td>8</td>
|
44 |
-
</tr>
|
45 |
-
<tr>
|
46 |
-
<td>Álgebra</td>
|
47 |
-
<td>10</td>
|
48 |
-
</tr>
|
49 |
-
<tr>
|
50 |
-
<td>Cálculo</td>
|
51 |
-
<td>35</td>
|
52 |
-
</tr>
|
53 |
-
<tr>
|
54 |
-
<td>Vectores y geometría tridimensional</td>
|
55 |
-
<td>14</td>
|
56 |
-
</tr>
|
57 |
-
<tr>
|
58 |
-
<td>Programación lineal</td>
|
59 |
-
<td>5</td>
|
60 |
-
</tr>
|
61 |
-
<tr>
|
62 |
-
<td>Probabilidad</td>
|
63 |
-
<td>8</td>
|
64 |
-
</tr>
|
65 |
-
<tr>
|
66 |
-
<td>Total</td>
|
67 |
-
<td>80</td>
|
68 |
-
</tr>
|
69 |
-
</tabla>
|
70 |
-
<h4>Temas y subtemas tratados</h4>
|
71 |
-
<p>La siguiente tabla muestra los temas y subtemas cubiertos en el Capítulo 5 Continuidad y diferenciabilidad:</p>
|
72 |
-
<tabla>
|
73 |
-
<tr>
|
74 |
-
<th>Tema</th>
|
75 |
-
<th>Subtema</th>
|
76 |
-
</tr>
|
77 |
-
<tr>
|
78 |
-
<td rowspan="3">Continuidad</td>
|
79 |
-
<td>Continuidad en un punto y en un intervalo. </td>
|
80 |
-
</tr>
|
81 |
-
<tr>
|
82 |
-
<td>Álgebra de funciones continuas. </td>
|
83 |
-
</tr>
|
84 |
-
<tr>
|
85 |
-
<td>Teorema del valor intermedio. </td>
|
86 |
-
</tr>
|
87 |
-
<tr>
|
88 |
-
<td rowspan="9">Diferenciabilidad</td>
|
89 |
-
<td>Diferenciabilidad en un punto y en un intervalo. </td>
|
90 |
-
</tr>
|
91 |
-
<tr>
|
92 |
-
<td>Álgebra de funciones diferenciables. </td>
|
93 |
-
</tr>
|
94 |
-
<tr>
|
95 |
-
<td>Derivados de funciones compuestas. </td>
|
96 |
-
</tr>
|
97 |
-
<tr>
|
98 |
-
<td>Derivadas de funciones implícitas. </td>
|
99 |
-
</tr>
|
100 |
-
<tr>
|
101 |
-
<td>Derivadas de funciones trigonométricas inversas. </td>
|
102 |
-
</tr>
|
103 |
-
<tr>
|
104 |
-
<td>Derivadas de funciones exponenciales y logarítmicas. </td>
|
105 |
-
</tr>
|
106 |
-
<tr>
|
107 |
-
<td>Diferenciación logarítmica. </td>
|
108 |
-
</tr>
|
109 |
-
<tr>
|
110 |
-
<td>Derivadas de funciones en formas paramétricas. </td>
|
111 |
-
</tr>
|
112 |
-
<tr>
|
113 |
-
<td>Derivados de segundo orden. </td>
|
114 |
-
</tr> <tr>
|
115 |
-
<td rowspan="2">Teoremas del valor medio</td>
|
116 |
-
<td>Teorema del valor medio. </td>
|
117 |
-
</tr>
|
118 |
-
<tr>
|
119 |
-
<td>Teorema de Rolle. </td>
|
120 |
-
</tr>
|
121 |
-
</tabla>
|
122 |
-
<h2>Capítulo 5 Matemáticas Clase 12 Preguntas importantes</h2>
|
123 |
-
|
124 |
-
<h3>¿Cuáles son las preguntas importantes para el capítulo 5 de la clase de matemáticas 12? </h3>
|
125 |
-
<p>Preguntas importantes para el Capítulo 5 Matemáticas Clase 12 son las preguntas que ponen a prueba su comprensión de los conceptos, fórmulas y métodos del capítulo. Pueden ser de diferentes tipos, como respuesta corta, respuesta larga, opción múltiple, llenar los espacios en blanco, verdadero o falso, coincidir con lo siguiente, etc. También pueden variar en el nivel de dificultad, de fácil a moderado a difícil. </p>
|
126 |
-
<h4>Tipos de preguntas importantes para el capítulo 5 Matemáticas Clase 12</h4>
|
127 |
-
<p>Algunos de los tipos de preguntas importantes para el Capítulo 5 Matemáticas Clase 12 son:</p>
|
128 |
-
<ul>
|
129 |
-
<li> Preguntas basadas en la definición y ejemplos de continuidad y diferenciabilidad de una función en un punto y en un intervalo. </li>
|
130 |
-
<li>Preguntas basadas en el álgebra de funciones continuas y diferenciables, como encontrar la suma, diferencia, producto, cociente o composición de dos o más funciones. </li>
|
131 |
-
<li>Preguntas basadas en encontrar las derivadas de varios tipos de funciones, tales como funciones compuestas, implícitas, trigonométricas inversas, exponenciales y logarítmicas. </li>
|
132 |
-
<li>Preguntas basadas en la aplicación de la diferenciación logarítmica para encontrar las derivadas de funciones que involucran poderes, productos o cocientes. </li>
|
133 |
-
<li>Preguntas basadas en encontrar las derivadas de funciones en formas paramétricas, como curvas o ecuaciones que involucran dos o más variables. </li>
|
134 |
-
<li>Preguntas basadas en encontrar las derivadas de segundo orden de las funciones y sus aplicaciones. </li>
|
135 |
-
<li> Preguntas basadas en verificar o aplicar el teorema del valor medio o el teorema de Rolle a una función o ecuación dada. </li>
|
136 |
-
</ul>
|
137 |
-
<h4>Fuentes de preguntas importantes para el Capítulo 5 Matemáticas Clase 12</h4>
|
138 |
-
<p>Algunas de las fuentes de preguntas importantes para el Capítulo 5 Matemáticas Clase 12 son:</p>
|
139 |
-
<ul>
|
140 |
-
<li>El libro de texto NCERT y el libro de ejemplo para la clase 12 Matemáticas.</li>
|
141 |
-
<li>El año anterior documentos de preguntas y documentos de muestra para el examen de la Junta de Matemáticas CBSE Clase 12. </li>
|
142 |
-
|
143 |
-
<li>Los libros de referencia y guías para CBSE clase 12 Matemáticas como R.D. Sharma, R.S. Aggarwal, etc.</li>
|
144 |
-
</ul>
|
145 |
-
<h2>Capítulo 5 Matemáticas Clase 12 Soluciones</h2>
|
146 |
-
<p>Otra forma de prepararse bien para su examen de Matemáticas CBSE Class 12 es consultar las soluciones para el Capítulo 5 Continuidad y diferenciabilidad. Estas son las explicaciones paso a paso y las respuestas a las preguntas y ejercicios dados en el libro de texto del NCERT y otras fuentes. Leer estas soluciones le ayudará a entender mejor los conceptos, métodos y fórmulas del capítulo. También te ayudarán a revisar tus respuestas, aclarar tus dudas y mejorar tu precisión. </p>
|
147 |
-
<h3>¿Cuáles son las soluciones para el capítulo 5 de la clase de matemáticas 12? </h3>
|
148 |
-
<p>Soluciones para el Capítulo 5 Matemáticas Clase 12 son las soluciones detalladas y precisas a las preguntas y ejercicios dados en el libro de texto de NCERT y otras fuentes para el Capítulo 5 Continuidad y diferenciabilidad. Están escritos por profesores expertos y expertos en la materia que tienen años de experiencia en la enseñanza de CBSE clase 12 Matemáticas. Siguen el último programa de estudios y el esquema de marcado del CBSE y se adhieren a las directrices del CBSE. </p>
|
149 |
-
<h4>Características de las soluciones para el capítulo 5 Matemáticas Clase 12</h4>
|
150 |
-
<p>Algunas de las características de las soluciones para el Capítulo 5 Matemáticas Clase 12 son:</p>
|
151 |
-
<ul>
|
152 |
-
<li>Cubren todos los temas y subtemas del capítulo de una manera sistemática y lógica. </li>
|
153 |
-
<li>Proporcionan explicaciones claras y concisas con ejemplos y diagramas relevantes siempre que sea necesario. </li>
|
154 |
-
<li> Utilizan un lenguaje simple y fácil de entender que es adecuado para los estudiantes de la clase 12 del CBSE. </li>
|
155 |
-
<li> Muestran todos los pasos y cálculos involucrados en la solución de un problema con el razonamiento y la justificación adecuados. </li>
|
156 |
-
<li> Resaltan los puntos importantes, las fórmulas y los consejos para recordar al resolver un problema. </li>
|
157 |
-
<li>También proporcionan métodos alternativos o atajos para resolver un problema siempre que sea posible. </li>
|
158 |
-
</ul>
|
159 |
-
<h4>Fuentes de soluciones para el capítulo 5 Matemáticas Clase 12</h4>
|
160 |
-
|
161 |
-
<ul>
|
162 |
-
<li>Las soluciones de NCERT para la clase 12 Matemáticas Capítulo 5 Continuidad y diferenciabilidad disponibles en el sitio web de NCERT o Vedantu. </li>
|
163 |
-
<li>Las soluciones de RD Sharma para la clase 12 Matemáticas Capítulo 5 Continuidad y diferenciabilidad disponibles en el sitio web de Vedantu u otras plataformas en línea. </li>
|
164 |
-
<li>Las soluciones de RS Aggarwal para la clase 12 Matemáticas Capítulo 5 Continuidad y diferenciabilidad disponibles en el sitio web de Vedantu u otras plataformas en línea. </li>
|
165 |
-
<li>Las conferencias en video y las clases en vivo de profesores y tutores expertos en YouTube, Vedantu, Toppr, etc.</li>
|
166 |
-
</ul>
|
167 |
-
<h2>Conclusión</h2>
|
168 |
-
<p>En este artículo, le hemos proporcionado toda la información que necesita para descargar el PDF del capítulo 5 de la clase de matemáticas 12 y prepararse para su examen de matemáticas CBSE Class 12. También le hemos dado el plan de estudios, preguntas importantes y soluciones para el Capítulo 5 Continuidad y diferenciabilidad. Esperamos que este artículo te haya ayudado a entender mejor el capítulo y aumentar tu confianza. Te deseamos todo lo mejor para tu examen. </p>
|
169 |
-
<h2>Preguntas frecuentes</h2>
|
170 |
-
<p>Aquí están algunas de las preguntas más frecuentes sobre el capítulo 5 Matemáticas Clase 12:</p>
|
171 |
-
<ol>
|
172 |
-
<li> ¿Cuál es la diferencia entre continuidad y diferenciabilidad de una función? </li>
|
173 |
-
<p>Una función es continua en un punto si el límite de la función en ese punto es igual al valor de la función en ese punto. Una función es diferenciable en un punto si la derivada de la función en ese punto existe y es finita. Una función puede ser continua pero no diferenciable en un punto, pero si una función es diferenciable en un punto, entonces también es continua en ese punto. </p>
|
174 |
-
<li> ¿Cuáles son las condiciones para que el teorema de Rolle y el teorema del valor medio sean aplicables? </li>
|
175 |
-
|
176 |
-
<li>¿Cómo encontrar las derivadas de las funciones trigonométricas inversas? </li>
|
177 |
-
<p>Las derivadas de las funciones trigonométricas inversas se pueden encontrar utilizando el método de diferenciación implícita. Por ejemplo, para encontrar la derivada de y = sin(x), podemos escribir x = sin(y) y diferenciar ambos lados con respecto a x. Obtenemos 1 = cos(y) dy/dx, lo que implica dy/dx = 1/cos(y). Dado que cos(y) = (1 - x), obtenemos dy/dx = 1/ (1 - x). De manera similar, podemos encontrar las derivadas de otras funciones trigonométricas inversas. </p>
|
178 |
-
<li> ¿Cómo usar la diferenciación logarítmica para encontrar las derivadas de funciones que involucran poderes, productos o cocientes? </li>
|
179 |
-
<p>La diferenciación logarítmica es una técnica que utiliza las propiedades de los logaritmos para simplificar la diferenciación de funciones que involucran poderes, productos o cocientes. Por ejemplo, para encontrar la derivada de y = x, podemos tomar el logaritmo natural de ambos lados y obtener ln(y) = x ln(x). Luego podemos diferenciar ambos lados con respecto a x y obtener (1/y) dy/dx = ln(x) + 1. Multiplicando ambos lados por y, obtenemos dy/dx = y (ln(x) + 1). Dado que y = x, obtenemos dy/dx = x (ln(x) + 1). Del mismo modo, podemos usar la diferenciación logarítmica para encontrar las derivadas de otras funciones que involucran poderes, productos o cocientes. </p>
|
180 |
-
<li>¿Cómo encontrar las derivadas de funciones en formas paramétricas? </li>
|
181 |
-
<p>Una función en forma paramétrica es una función que se expresa en términos de uno o más parámetros. Por ejemplo, una curva puede ser representada por x = f(t) e y = g(t), donde t es un parámetro. Para encontrar la derivada de y con respecto a x, podemos usar la regla de cadena y obtener dy/dx = (dy/dt)/(dx/dt). Para encontrar la segunda derivada de y con respecto a x, podemos usar la regla del cociente y obtener d 2y/dx = (dy/dt)(dx/dt) - (dy/dt)(dx/dt)/(dx/dt). Del mismo modo, podemos encontrar las derivadas de otras funciones en formas paramétricas. </p> 64aa2da5cf<br />
|
182 |
-
<br />
|
183 |
-
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Big-Web/MMSD/env/Lib/site-packages/botocore/auth.py
DELETED
@@ -1,990 +0,0 @@
|
|
1 |
-
# Copyright (c) 2012-2013 Mitch Garnaat http://garnaat.org/
|
2 |
-
# Copyright 2012-2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
3 |
-
#
|
4 |
-
# Licensed under the Apache License, Version 2.0 (the "License"). You
|
5 |
-
# may not use this file except in compliance with the License. A copy of
|
6 |
-
# the License is located at
|
7 |
-
#
|
8 |
-
# http://aws.amazon.com/apache2.0/
|
9 |
-
#
|
10 |
-
# or in the "license" file accompanying this file. This file is
|
11 |
-
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
12 |
-
# ANY KIND, either express or implied. See the License for the specific
|
13 |
-
# language governing permissions and limitations under the License.
|
14 |
-
import base64
|
15 |
-
import calendar
|
16 |
-
import datetime
|
17 |
-
import functools
|
18 |
-
import hmac
|
19 |
-
import json
|
20 |
-
import logging
|
21 |
-
import time
|
22 |
-
from collections.abc import Mapping
|
23 |
-
from email.utils import formatdate
|
24 |
-
from hashlib import sha1, sha256
|
25 |
-
from operator import itemgetter
|
26 |
-
|
27 |
-
from botocore.compat import (
|
28 |
-
HAS_CRT,
|
29 |
-
HTTPHeaders,
|
30 |
-
encodebytes,
|
31 |
-
ensure_unicode,
|
32 |
-
parse_qs,
|
33 |
-
quote,
|
34 |
-
unquote,
|
35 |
-
urlsplit,
|
36 |
-
urlunsplit,
|
37 |
-
)
|
38 |
-
from botocore.exceptions import NoAuthTokenError, NoCredentialsError
|
39 |
-
from botocore.utils import (
|
40 |
-
is_valid_ipv6_endpoint_url,
|
41 |
-
normalize_url_path,
|
42 |
-
percent_encode_sequence,
|
43 |
-
)
|
44 |
-
|
45 |
-
# Imports for backwards compatibility
|
46 |
-
from botocore.compat import MD5_AVAILABLE # noqa
|
47 |
-
|
48 |
-
|
49 |
-
logger = logging.getLogger(__name__)
|
50 |
-
|
51 |
-
|
52 |
-
EMPTY_SHA256_HASH = (
|
53 |
-
'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
|
54 |
-
)
|
55 |
-
# This is the buffer size used when calculating sha256 checksums.
|
56 |
-
# Experimenting with various buffer sizes showed that this value generally
|
57 |
-
# gave the best result (in terms of performance).
|
58 |
-
PAYLOAD_BUFFER = 1024 * 1024
|
59 |
-
ISO8601 = '%Y-%m-%dT%H:%M:%SZ'
|
60 |
-
SIGV4_TIMESTAMP = '%Y%m%dT%H%M%SZ'
|
61 |
-
SIGNED_HEADERS_BLACKLIST = [
|
62 |
-
'expect',
|
63 |
-
'user-agent',
|
64 |
-
'x-amzn-trace-id',
|
65 |
-
]
|
66 |
-
UNSIGNED_PAYLOAD = 'UNSIGNED-PAYLOAD'
|
67 |
-
STREAMING_UNSIGNED_PAYLOAD_TRAILER = 'STREAMING-UNSIGNED-PAYLOAD-TRAILER'
|
68 |
-
|
69 |
-
|
70 |
-
def _host_from_url(url):
|
71 |
-
# Given URL, derive value for host header. Ensure that value:
|
72 |
-
# 1) is lowercase
|
73 |
-
# 2) excludes port, if it was the default port
|
74 |
-
# 3) excludes userinfo
|
75 |
-
url_parts = urlsplit(url)
|
76 |
-
host = url_parts.hostname # urlsplit's hostname is always lowercase
|
77 |
-
if is_valid_ipv6_endpoint_url(url):
|
78 |
-
host = f'[{host}]'
|
79 |
-
default_ports = {
|
80 |
-
'http': 80,
|
81 |
-
'https': 443,
|
82 |
-
}
|
83 |
-
if url_parts.port is not None:
|
84 |
-
if url_parts.port != default_ports.get(url_parts.scheme):
|
85 |
-
host = '%s:%d' % (host, url_parts.port)
|
86 |
-
return host
|
87 |
-
|
88 |
-
|
89 |
-
def _get_body_as_dict(request):
|
90 |
-
# For query services, request.data is form-encoded and is already a
|
91 |
-
# dict, but for other services such as rest-json it could be a json
|
92 |
-
# string or bytes. In those cases we attempt to load the data as a
|
93 |
-
# dict.
|
94 |
-
data = request.data
|
95 |
-
if isinstance(data, bytes):
|
96 |
-
data = json.loads(data.decode('utf-8'))
|
97 |
-
elif isinstance(data, str):
|
98 |
-
data = json.loads(data)
|
99 |
-
return data
|
100 |
-
|
101 |
-
|
102 |
-
class BaseSigner:
|
103 |
-
REQUIRES_REGION = False
|
104 |
-
REQUIRES_TOKEN = False
|
105 |
-
|
106 |
-
def add_auth(self, request):
|
107 |
-
raise NotImplementedError("add_auth")
|
108 |
-
|
109 |
-
|
110 |
-
class TokenSigner(BaseSigner):
|
111 |
-
REQUIRES_TOKEN = True
|
112 |
-
"""
|
113 |
-
Signers that expect an authorization token to perform the authorization
|
114 |
-
"""
|
115 |
-
|
116 |
-
def __init__(self, auth_token):
|
117 |
-
self.auth_token = auth_token
|
118 |
-
|
119 |
-
|
120 |
-
class SigV2Auth(BaseSigner):
|
121 |
-
"""
|
122 |
-
Sign a request with Signature V2.
|
123 |
-
"""
|
124 |
-
|
125 |
-
def __init__(self, credentials):
|
126 |
-
self.credentials = credentials
|
127 |
-
|
128 |
-
def calc_signature(self, request, params):
|
129 |
-
logger.debug("Calculating signature using v2 auth.")
|
130 |
-
split = urlsplit(request.url)
|
131 |
-
path = split.path
|
132 |
-
if len(path) == 0:
|
133 |
-
path = '/'
|
134 |
-
string_to_sign = f"{request.method}\n{split.netloc}\n{path}\n"
|
135 |
-
lhmac = hmac.new(
|
136 |
-
self.credentials.secret_key.encode("utf-8"), digestmod=sha256
|
137 |
-
)
|
138 |
-
pairs = []
|
139 |
-
for key in sorted(params):
|
140 |
-
# Any previous signature should not be a part of this
|
141 |
-
# one, so we skip that particular key. This prevents
|
142 |
-
# issues during retries.
|
143 |
-
if key == 'Signature':
|
144 |
-
continue
|
145 |
-
value = str(params[key])
|
146 |
-
quoted_key = quote(key.encode('utf-8'), safe='')
|
147 |
-
quoted_value = quote(value.encode('utf-8'), safe='-_~')
|
148 |
-
pairs.append(f'{quoted_key}={quoted_value}')
|
149 |
-
qs = '&'.join(pairs)
|
150 |
-
string_to_sign += qs
|
151 |
-
logger.debug('String to sign: %s', string_to_sign)
|
152 |
-
lhmac.update(string_to_sign.encode('utf-8'))
|
153 |
-
b64 = base64.b64encode(lhmac.digest()).strip().decode('utf-8')
|
154 |
-
return (qs, b64)
|
155 |
-
|
156 |
-
def add_auth(self, request):
|
157 |
-
# The auth handler is the last thing called in the
|
158 |
-
# preparation phase of a prepared request.
|
159 |
-
# Because of this we have to parse the query params
|
160 |
-
# from the request body so we can update them with
|
161 |
-
# the sigv2 auth params.
|
162 |
-
if self.credentials is None:
|
163 |
-
raise NoCredentialsError()
|
164 |
-
if request.data:
|
165 |
-
# POST
|
166 |
-
params = request.data
|
167 |
-
else:
|
168 |
-
# GET
|
169 |
-
params = request.params
|
170 |
-
params['AWSAccessKeyId'] = self.credentials.access_key
|
171 |
-
params['SignatureVersion'] = '2'
|
172 |
-
params['SignatureMethod'] = 'HmacSHA256'
|
173 |
-
params['Timestamp'] = time.strftime(ISO8601, time.gmtime())
|
174 |
-
if self.credentials.token:
|
175 |
-
params['SecurityToken'] = self.credentials.token
|
176 |
-
qs, signature = self.calc_signature(request, params)
|
177 |
-
params['Signature'] = signature
|
178 |
-
return request
|
179 |
-
|
180 |
-
|
181 |
-
class SigV3Auth(BaseSigner):
|
182 |
-
def __init__(self, credentials):
|
183 |
-
self.credentials = credentials
|
184 |
-
|
185 |
-
def add_auth(self, request):
|
186 |
-
if self.credentials is None:
|
187 |
-
raise NoCredentialsError()
|
188 |
-
if 'Date' in request.headers:
|
189 |
-
del request.headers['Date']
|
190 |
-
request.headers['Date'] = formatdate(usegmt=True)
|
191 |
-
if self.credentials.token:
|
192 |
-
if 'X-Amz-Security-Token' in request.headers:
|
193 |
-
del request.headers['X-Amz-Security-Token']
|
194 |
-
request.headers['X-Amz-Security-Token'] = self.credentials.token
|
195 |
-
new_hmac = hmac.new(
|
196 |
-
self.credentials.secret_key.encode('utf-8'), digestmod=sha256
|
197 |
-
)
|
198 |
-
new_hmac.update(request.headers['Date'].encode('utf-8'))
|
199 |
-
encoded_signature = encodebytes(new_hmac.digest()).strip()
|
200 |
-
signature = (
|
201 |
-
f"AWS3-HTTPS AWSAccessKeyId={self.credentials.access_key},"
|
202 |
-
f"Algorithm=HmacSHA256,Signature={encoded_signature.decode('utf-8')}"
|
203 |
-
)
|
204 |
-
if 'X-Amzn-Authorization' in request.headers:
|
205 |
-
del request.headers['X-Amzn-Authorization']
|
206 |
-
request.headers['X-Amzn-Authorization'] = signature
|
207 |
-
|
208 |
-
|
209 |
-
class SigV4Auth(BaseSigner):
|
210 |
-
"""
|
211 |
-
Sign a request with Signature V4.
|
212 |
-
"""
|
213 |
-
|
214 |
-
REQUIRES_REGION = True
|
215 |
-
|
216 |
-
def __init__(self, credentials, service_name, region_name):
|
217 |
-
self.credentials = credentials
|
218 |
-
# We initialize these value here so the unit tests can have
|
219 |
-
# valid values. But these will get overriden in ``add_auth``
|
220 |
-
# later for real requests.
|
221 |
-
self._region_name = region_name
|
222 |
-
self._service_name = service_name
|
223 |
-
|
224 |
-
def _sign(self, key, msg, hex=False):
|
225 |
-
if hex:
|
226 |
-
sig = hmac.new(key, msg.encode('utf-8'), sha256).hexdigest()
|
227 |
-
else:
|
228 |
-
sig = hmac.new(key, msg.encode('utf-8'), sha256).digest()
|
229 |
-
return sig
|
230 |
-
|
231 |
-
def headers_to_sign(self, request):
|
232 |
-
"""
|
233 |
-
Select the headers from the request that need to be included
|
234 |
-
in the StringToSign.
|
235 |
-
"""
|
236 |
-
header_map = HTTPHeaders()
|
237 |
-
for name, value in request.headers.items():
|
238 |
-
lname = name.lower()
|
239 |
-
if lname not in SIGNED_HEADERS_BLACKLIST:
|
240 |
-
header_map[lname] = value
|
241 |
-
if 'host' not in header_map:
|
242 |
-
# TODO: We should set the host ourselves, instead of relying on our
|
243 |
-
# HTTP client to set it for us.
|
244 |
-
header_map['host'] = _host_from_url(request.url)
|
245 |
-
return header_map
|
246 |
-
|
247 |
-
def canonical_query_string(self, request):
|
248 |
-
# The query string can come from two parts. One is the
|
249 |
-
# params attribute of the request. The other is from the request
|
250 |
-
# url (in which case we have to re-split the url into its components
|
251 |
-
# and parse out the query string component).
|
252 |
-
if request.params:
|
253 |
-
return self._canonical_query_string_params(request.params)
|
254 |
-
else:
|
255 |
-
return self._canonical_query_string_url(urlsplit(request.url))
|
256 |
-
|
257 |
-
def _canonical_query_string_params(self, params):
|
258 |
-
# [(key, value), (key2, value2)]
|
259 |
-
key_val_pairs = []
|
260 |
-
if isinstance(params, Mapping):
|
261 |
-
params = params.items()
|
262 |
-
for key, value in params:
|
263 |
-
key_val_pairs.append(
|
264 |
-
(quote(key, safe='-_.~'), quote(str(value), safe='-_.~'))
|
265 |
-
)
|
266 |
-
sorted_key_vals = []
|
267 |
-
# Sort by the URI-encoded key names, and in the case of
|
268 |
-
# repeated keys, then sort by the value.
|
269 |
-
for key, value in sorted(key_val_pairs):
|
270 |
-
sorted_key_vals.append(f'{key}={value}')
|
271 |
-
canonical_query_string = '&'.join(sorted_key_vals)
|
272 |
-
return canonical_query_string
|
273 |
-
|
274 |
-
def _canonical_query_string_url(self, parts):
|
275 |
-
canonical_query_string = ''
|
276 |
-
if parts.query:
|
277 |
-
# [(key, value), (key2, value2)]
|
278 |
-
key_val_pairs = []
|
279 |
-
for pair in parts.query.split('&'):
|
280 |
-
key, _, value = pair.partition('=')
|
281 |
-
key_val_pairs.append((key, value))
|
282 |
-
sorted_key_vals = []
|
283 |
-
# Sort by the URI-encoded key names, and in the case of
|
284 |
-
# repeated keys, then sort by the value.
|
285 |
-
for key, value in sorted(key_val_pairs):
|
286 |
-
sorted_key_vals.append(f'{key}={value}')
|
287 |
-
canonical_query_string = '&'.join(sorted_key_vals)
|
288 |
-
return canonical_query_string
|
289 |
-
|
290 |
-
def canonical_headers(self, headers_to_sign):
|
291 |
-
"""
|
292 |
-
Return the headers that need to be included in the StringToSign
|
293 |
-
in their canonical form by converting all header keys to lower
|
294 |
-
case, sorting them in alphabetical order and then joining
|
295 |
-
them into a string, separated by newlines.
|
296 |
-
"""
|
297 |
-
headers = []
|
298 |
-
sorted_header_names = sorted(set(headers_to_sign))
|
299 |
-
for key in sorted_header_names:
|
300 |
-
value = ','.join(
|
301 |
-
self._header_value(v) for v in headers_to_sign.get_all(key)
|
302 |
-
)
|
303 |
-
headers.append(f'{key}:{ensure_unicode(value)}')
|
304 |
-
return '\n'.join(headers)
|
305 |
-
|
306 |
-
def _header_value(self, value):
|
307 |
-
# From the sigv4 docs:
|
308 |
-
# Lowercase(HeaderName) + ':' + Trimall(HeaderValue)
|
309 |
-
#
|
310 |
-
# The Trimall function removes excess white space before and after
|
311 |
-
# values, and converts sequential spaces to a single space.
|
312 |
-
return ' '.join(value.split())
|
313 |
-
|
314 |
-
def signed_headers(self, headers_to_sign):
|
315 |
-
headers = sorted(n.lower().strip() for n in set(headers_to_sign))
|
316 |
-
return ';'.join(headers)
|
317 |
-
|
318 |
-
def _is_streaming_checksum_payload(self, request):
|
319 |
-
checksum_context = request.context.get('checksum', {})
|
320 |
-
algorithm = checksum_context.get('request_algorithm')
|
321 |
-
return isinstance(algorithm, dict) and algorithm.get('in') == 'trailer'
|
322 |
-
|
323 |
-
def payload(self, request):
|
324 |
-
if self._is_streaming_checksum_payload(request):
|
325 |
-
return STREAMING_UNSIGNED_PAYLOAD_TRAILER
|
326 |
-
elif not self._should_sha256_sign_payload(request):
|
327 |
-
# When payload signing is disabled, we use this static string in
|
328 |
-
# place of the payload checksum.
|
329 |
-
return UNSIGNED_PAYLOAD
|
330 |
-
request_body = request.body
|
331 |
-
if request_body and hasattr(request_body, 'seek'):
|
332 |
-
position = request_body.tell()
|
333 |
-
read_chunksize = functools.partial(
|
334 |
-
request_body.read, PAYLOAD_BUFFER
|
335 |
-
)
|
336 |
-
checksum = sha256()
|
337 |
-
for chunk in iter(read_chunksize, b''):
|
338 |
-
checksum.update(chunk)
|
339 |
-
hex_checksum = checksum.hexdigest()
|
340 |
-
request_body.seek(position)
|
341 |
-
return hex_checksum
|
342 |
-
elif request_body:
|
343 |
-
# The request serialization has ensured that
|
344 |
-
# request.body is a bytes() type.
|
345 |
-
return sha256(request_body).hexdigest()
|
346 |
-
else:
|
347 |
-
return EMPTY_SHA256_HASH
|
348 |
-
|
349 |
-
def _should_sha256_sign_payload(self, request):
|
350 |
-
# Payloads will always be signed over insecure connections.
|
351 |
-
if not request.url.startswith('https'):
|
352 |
-
return True
|
353 |
-
|
354 |
-
# Certain operations may have payload signing disabled by default.
|
355 |
-
# Since we don't have access to the operation model, we pass in this
|
356 |
-
# bit of metadata through the request context.
|
357 |
-
return request.context.get('payload_signing_enabled', True)
|
358 |
-
|
359 |
-
def canonical_request(self, request):
|
360 |
-
cr = [request.method.upper()]
|
361 |
-
path = self._normalize_url_path(urlsplit(request.url).path)
|
362 |
-
cr.append(path)
|
363 |
-
cr.append(self.canonical_query_string(request))
|
364 |
-
headers_to_sign = self.headers_to_sign(request)
|
365 |
-
cr.append(self.canonical_headers(headers_to_sign) + '\n')
|
366 |
-
cr.append(self.signed_headers(headers_to_sign))
|
367 |
-
if 'X-Amz-Content-SHA256' in request.headers:
|
368 |
-
body_checksum = request.headers['X-Amz-Content-SHA256']
|
369 |
-
else:
|
370 |
-
body_checksum = self.payload(request)
|
371 |
-
cr.append(body_checksum)
|
372 |
-
return '\n'.join(cr)
|
373 |
-
|
374 |
-
def _normalize_url_path(self, path):
|
375 |
-
normalized_path = quote(normalize_url_path(path), safe='/~')
|
376 |
-
return normalized_path
|
377 |
-
|
378 |
-
def scope(self, request):
|
379 |
-
scope = [self.credentials.access_key]
|
380 |
-
scope.append(request.context['timestamp'][0:8])
|
381 |
-
scope.append(self._region_name)
|
382 |
-
scope.append(self._service_name)
|
383 |
-
scope.append('aws4_request')
|
384 |
-
return '/'.join(scope)
|
385 |
-
|
386 |
-
def credential_scope(self, request):
|
387 |
-
scope = []
|
388 |
-
scope.append(request.context['timestamp'][0:8])
|
389 |
-
scope.append(self._region_name)
|
390 |
-
scope.append(self._service_name)
|
391 |
-
scope.append('aws4_request')
|
392 |
-
return '/'.join(scope)
|
393 |
-
|
394 |
-
def string_to_sign(self, request, canonical_request):
|
395 |
-
"""
|
396 |
-
Return the canonical StringToSign as well as a dict
|
397 |
-
containing the original version of all headers that
|
398 |
-
were included in the StringToSign.
|
399 |
-
"""
|
400 |
-
sts = ['AWS4-HMAC-SHA256']
|
401 |
-
sts.append(request.context['timestamp'])
|
402 |
-
sts.append(self.credential_scope(request))
|
403 |
-
sts.append(sha256(canonical_request.encode('utf-8')).hexdigest())
|
404 |
-
return '\n'.join(sts)
|
405 |
-
|
406 |
-
def signature(self, string_to_sign, request):
|
407 |
-
key = self.credentials.secret_key
|
408 |
-
k_date = self._sign(
|
409 |
-
(f"AWS4{key}").encode(), request.context["timestamp"][0:8]
|
410 |
-
)
|
411 |
-
k_region = self._sign(k_date, self._region_name)
|
412 |
-
k_service = self._sign(k_region, self._service_name)
|
413 |
-
k_signing = self._sign(k_service, 'aws4_request')
|
414 |
-
return self._sign(k_signing, string_to_sign, hex=True)
|
415 |
-
|
416 |
-
def add_auth(self, request):
|
417 |
-
if self.credentials is None:
|
418 |
-
raise NoCredentialsError()
|
419 |
-
datetime_now = datetime.datetime.utcnow()
|
420 |
-
request.context['timestamp'] = datetime_now.strftime(SIGV4_TIMESTAMP)
|
421 |
-
# This could be a retry. Make sure the previous
|
422 |
-
# authorization header is removed first.
|
423 |
-
self._modify_request_before_signing(request)
|
424 |
-
canonical_request = self.canonical_request(request)
|
425 |
-
logger.debug("Calculating signature using v4 auth.")
|
426 |
-
logger.debug('CanonicalRequest:\n%s', canonical_request)
|
427 |
-
string_to_sign = self.string_to_sign(request, canonical_request)
|
428 |
-
logger.debug('StringToSign:\n%s', string_to_sign)
|
429 |
-
signature = self.signature(string_to_sign, request)
|
430 |
-
logger.debug('Signature:\n%s', signature)
|
431 |
-
|
432 |
-
self._inject_signature_to_request(request, signature)
|
433 |
-
|
434 |
-
def _inject_signature_to_request(self, request, signature):
|
435 |
-
auth_str = ['AWS4-HMAC-SHA256 Credential=%s' % self.scope(request)]
|
436 |
-
headers_to_sign = self.headers_to_sign(request)
|
437 |
-
auth_str.append(
|
438 |
-
f"SignedHeaders={self.signed_headers(headers_to_sign)}"
|
439 |
-
)
|
440 |
-
auth_str.append('Signature=%s' % signature)
|
441 |
-
request.headers['Authorization'] = ', '.join(auth_str)
|
442 |
-
return request
|
443 |
-
|
444 |
-
def _modify_request_before_signing(self, request):
|
445 |
-
if 'Authorization' in request.headers:
|
446 |
-
del request.headers['Authorization']
|
447 |
-
self._set_necessary_date_headers(request)
|
448 |
-
if self.credentials.token:
|
449 |
-
if 'X-Amz-Security-Token' in request.headers:
|
450 |
-
del request.headers['X-Amz-Security-Token']
|
451 |
-
request.headers['X-Amz-Security-Token'] = self.credentials.token
|
452 |
-
|
453 |
-
if not request.context.get('payload_signing_enabled', True):
|
454 |
-
if 'X-Amz-Content-SHA256' in request.headers:
|
455 |
-
del request.headers['X-Amz-Content-SHA256']
|
456 |
-
request.headers['X-Amz-Content-SHA256'] = UNSIGNED_PAYLOAD
|
457 |
-
|
458 |
-
def _set_necessary_date_headers(self, request):
|
459 |
-
# The spec allows for either the Date _or_ the X-Amz-Date value to be
|
460 |
-
# used so we check both. If there's a Date header, we use the date
|
461 |
-
# header. Otherwise we use the X-Amz-Date header.
|
462 |
-
if 'Date' in request.headers:
|
463 |
-
del request.headers['Date']
|
464 |
-
datetime_timestamp = datetime.datetime.strptime(
|
465 |
-
request.context['timestamp'], SIGV4_TIMESTAMP
|
466 |
-
)
|
467 |
-
request.headers['Date'] = formatdate(
|
468 |
-
int(calendar.timegm(datetime_timestamp.timetuple()))
|
469 |
-
)
|
470 |
-
if 'X-Amz-Date' in request.headers:
|
471 |
-
del request.headers['X-Amz-Date']
|
472 |
-
else:
|
473 |
-
if 'X-Amz-Date' in request.headers:
|
474 |
-
del request.headers['X-Amz-Date']
|
475 |
-
request.headers['X-Amz-Date'] = request.context['timestamp']
|
476 |
-
|
477 |
-
|
478 |
-
class S3SigV4Auth(SigV4Auth):
|
479 |
-
def _modify_request_before_signing(self, request):
|
480 |
-
super()._modify_request_before_signing(request)
|
481 |
-
if 'X-Amz-Content-SHA256' in request.headers:
|
482 |
-
del request.headers['X-Amz-Content-SHA256']
|
483 |
-
|
484 |
-
request.headers['X-Amz-Content-SHA256'] = self.payload(request)
|
485 |
-
|
486 |
-
def _should_sha256_sign_payload(self, request):
|
487 |
-
# S3 allows optional body signing, so to minimize the performance
|
488 |
-
# impact, we opt to not SHA256 sign the body on streaming uploads,
|
489 |
-
# provided that we're on https.
|
490 |
-
client_config = request.context.get('client_config')
|
491 |
-
s3_config = getattr(client_config, 's3', None)
|
492 |
-
|
493 |
-
# The config could be None if it isn't set, or if the customer sets it
|
494 |
-
# to None.
|
495 |
-
if s3_config is None:
|
496 |
-
s3_config = {}
|
497 |
-
|
498 |
-
# The explicit configuration takes precedence over any implicit
|
499 |
-
# configuration.
|
500 |
-
sign_payload = s3_config.get('payload_signing_enabled', None)
|
501 |
-
if sign_payload is not None:
|
502 |
-
return sign_payload
|
503 |
-
|
504 |
-
# We require that both a checksum be present and https be enabled
|
505 |
-
# to implicitly disable body signing. The combination of TLS and
|
506 |
-
# a checksum is sufficiently secure and durable for us to be
|
507 |
-
# confident in the request without body signing.
|
508 |
-
checksum_header = 'Content-MD5'
|
509 |
-
checksum_context = request.context.get('checksum', {})
|
510 |
-
algorithm = checksum_context.get('request_algorithm')
|
511 |
-
if isinstance(algorithm, dict) and algorithm.get('in') == 'header':
|
512 |
-
checksum_header = algorithm['name']
|
513 |
-
if (
|
514 |
-
not request.url.startswith("https")
|
515 |
-
or checksum_header not in request.headers
|
516 |
-
):
|
517 |
-
return True
|
518 |
-
|
519 |
-
# If the input is streaming we disable body signing by default.
|
520 |
-
if request.context.get('has_streaming_input', False):
|
521 |
-
return False
|
522 |
-
|
523 |
-
# If the S3-specific checks had no results, delegate to the generic
|
524 |
-
# checks.
|
525 |
-
return super()._should_sha256_sign_payload(request)
|
526 |
-
|
527 |
-
def _normalize_url_path(self, path):
|
528 |
-
# For S3, we do not normalize the path.
|
529 |
-
return path
|
530 |
-
|
531 |
-
|
532 |
-
class SigV4QueryAuth(SigV4Auth):
|
533 |
-
DEFAULT_EXPIRES = 3600
|
534 |
-
|
535 |
-
def __init__(
|
536 |
-
self, credentials, service_name, region_name, expires=DEFAULT_EXPIRES
|
537 |
-
):
|
538 |
-
super().__init__(credentials, service_name, region_name)
|
539 |
-
self._expires = expires
|
540 |
-
|
541 |
-
def _modify_request_before_signing(self, request):
|
542 |
-
# We automatically set this header, so if it's the auto-set value we
|
543 |
-
# want to get rid of it since it doesn't make sense for presigned urls.
|
544 |
-
content_type = request.headers.get('content-type')
|
545 |
-
blacklisted_content_type = (
|
546 |
-
'application/x-www-form-urlencoded; charset=utf-8'
|
547 |
-
)
|
548 |
-
if content_type == blacklisted_content_type:
|
549 |
-
del request.headers['content-type']
|
550 |
-
|
551 |
-
# Note that we're not including X-Amz-Signature.
|
552 |
-
# From the docs: "The Canonical Query String must include all the query
|
553 |
-
# parameters from the preceding table except for X-Amz-Signature.
|
554 |
-
signed_headers = self.signed_headers(self.headers_to_sign(request))
|
555 |
-
|
556 |
-
auth_params = {
|
557 |
-
'X-Amz-Algorithm': 'AWS4-HMAC-SHA256',
|
558 |
-
'X-Amz-Credential': self.scope(request),
|
559 |
-
'X-Amz-Date': request.context['timestamp'],
|
560 |
-
'X-Amz-Expires': self._expires,
|
561 |
-
'X-Amz-SignedHeaders': signed_headers,
|
562 |
-
}
|
563 |
-
if self.credentials.token is not None:
|
564 |
-
auth_params['X-Amz-Security-Token'] = self.credentials.token
|
565 |
-
# Now parse the original query string to a dict, inject our new query
|
566 |
-
# params, and serialize back to a query string.
|
567 |
-
url_parts = urlsplit(request.url)
|
568 |
-
# parse_qs makes each value a list, but in our case we know we won't
|
569 |
-
# have repeated keys so we know we have single element lists which we
|
570 |
-
# can convert back to scalar values.
|
571 |
-
query_string_parts = parse_qs(url_parts.query, keep_blank_values=True)
|
572 |
-
query_dict = {k: v[0] for k, v in query_string_parts.items()}
|
573 |
-
|
574 |
-
if request.params:
|
575 |
-
query_dict.update(request.params)
|
576 |
-
request.params = {}
|
577 |
-
# The spec is particular about this. It *has* to be:
|
578 |
-
# https://<endpoint>?<operation params>&<auth params>
|
579 |
-
# You can't mix the two types of params together, i.e just keep doing
|
580 |
-
# new_query_params.update(op_params)
|
581 |
-
# new_query_params.update(auth_params)
|
582 |
-
# percent_encode_sequence(new_query_params)
|
583 |
-
operation_params = ''
|
584 |
-
if request.data:
|
585 |
-
# We also need to move the body params into the query string. To
|
586 |
-
# do this, we first have to convert it to a dict.
|
587 |
-
query_dict.update(_get_body_as_dict(request))
|
588 |
-
request.data = ''
|
589 |
-
if query_dict:
|
590 |
-
operation_params = percent_encode_sequence(query_dict) + '&'
|
591 |
-
new_query_string = (
|
592 |
-
f"{operation_params}{percent_encode_sequence(auth_params)}"
|
593 |
-
)
|
594 |
-
# url_parts is a tuple (and therefore immutable) so we need to create
|
595 |
-
# a new url_parts with the new query string.
|
596 |
-
# <part> - <index>
|
597 |
-
# scheme - 0
|
598 |
-
# netloc - 1
|
599 |
-
# path - 2
|
600 |
-
# query - 3 <-- we're replacing this.
|
601 |
-
# fragment - 4
|
602 |
-
p = url_parts
|
603 |
-
new_url_parts = (p[0], p[1], p[2], new_query_string, p[4])
|
604 |
-
request.url = urlunsplit(new_url_parts)
|
605 |
-
|
606 |
-
def _inject_signature_to_request(self, request, signature):
|
607 |
-
# Rather than calculating an "Authorization" header, for the query
|
608 |
-
# param quth, we just append an 'X-Amz-Signature' param to the end
|
609 |
-
# of the query string.
|
610 |
-
request.url += '&X-Amz-Signature=%s' % signature
|
611 |
-
|
612 |
-
|
613 |
-
class S3SigV4QueryAuth(SigV4QueryAuth):
|
614 |
-
"""S3 SigV4 auth using query parameters.
|
615 |
-
|
616 |
-
This signer will sign a request using query parameters and signature
|
617 |
-
version 4, i.e a "presigned url" signer.
|
618 |
-
|
619 |
-
Based off of:
|
620 |
-
|
621 |
-
http://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-query-string-auth.html
|
622 |
-
|
623 |
-
"""
|
624 |
-
|
625 |
-
def _normalize_url_path(self, path):
|
626 |
-
# For S3, we do not normalize the path.
|
627 |
-
return path
|
628 |
-
|
629 |
-
def payload(self, request):
|
630 |
-
# From the doc link above:
|
631 |
-
# "You don't include a payload hash in the Canonical Request, because
|
632 |
-
# when you create a presigned URL, you don't know anything about the
|
633 |
-
# payload. Instead, you use a constant string "UNSIGNED-PAYLOAD".
|
634 |
-
return UNSIGNED_PAYLOAD
|
635 |
-
|
636 |
-
|
637 |
-
class S3SigV4PostAuth(SigV4Auth):
|
638 |
-
"""
|
639 |
-
Presigns a s3 post
|
640 |
-
|
641 |
-
Implementation doc here:
|
642 |
-
http://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-UsingHTTPPOST.html
|
643 |
-
"""
|
644 |
-
|
645 |
-
def add_auth(self, request):
|
646 |
-
datetime_now = datetime.datetime.utcnow()
|
647 |
-
request.context['timestamp'] = datetime_now.strftime(SIGV4_TIMESTAMP)
|
648 |
-
|
649 |
-
fields = {}
|
650 |
-
if request.context.get('s3-presign-post-fields', None) is not None:
|
651 |
-
fields = request.context['s3-presign-post-fields']
|
652 |
-
|
653 |
-
policy = {}
|
654 |
-
conditions = []
|
655 |
-
if request.context.get('s3-presign-post-policy', None) is not None:
|
656 |
-
policy = request.context['s3-presign-post-policy']
|
657 |
-
if policy.get('conditions', None) is not None:
|
658 |
-
conditions = policy['conditions']
|
659 |
-
|
660 |
-
policy['conditions'] = conditions
|
661 |
-
|
662 |
-
fields['x-amz-algorithm'] = 'AWS4-HMAC-SHA256'
|
663 |
-
fields['x-amz-credential'] = self.scope(request)
|
664 |
-
fields['x-amz-date'] = request.context['timestamp']
|
665 |
-
|
666 |
-
conditions.append({'x-amz-algorithm': 'AWS4-HMAC-SHA256'})
|
667 |
-
conditions.append({'x-amz-credential': self.scope(request)})
|
668 |
-
conditions.append({'x-amz-date': request.context['timestamp']})
|
669 |
-
|
670 |
-
if self.credentials.token is not None:
|
671 |
-
fields['x-amz-security-token'] = self.credentials.token
|
672 |
-
conditions.append({'x-amz-security-token': self.credentials.token})
|
673 |
-
|
674 |
-
# Dump the base64 encoded policy into the fields dictionary.
|
675 |
-
fields['policy'] = base64.b64encode(
|
676 |
-
json.dumps(policy).encode('utf-8')
|
677 |
-
).decode('utf-8')
|
678 |
-
|
679 |
-
fields['x-amz-signature'] = self.signature(fields['policy'], request)
|
680 |
-
|
681 |
-
request.context['s3-presign-post-fields'] = fields
|
682 |
-
request.context['s3-presign-post-policy'] = policy
|
683 |
-
|
684 |
-
|
685 |
-
class HmacV1Auth(BaseSigner):
|
686 |
-
|
687 |
-
# List of Query String Arguments of Interest
|
688 |
-
QSAOfInterest = [
|
689 |
-
'accelerate',
|
690 |
-
'acl',
|
691 |
-
'cors',
|
692 |
-
'defaultObjectAcl',
|
693 |
-
'location',
|
694 |
-
'logging',
|
695 |
-
'partNumber',
|
696 |
-
'policy',
|
697 |
-
'requestPayment',
|
698 |
-
'torrent',
|
699 |
-
'versioning',
|
700 |
-
'versionId',
|
701 |
-
'versions',
|
702 |
-
'website',
|
703 |
-
'uploads',
|
704 |
-
'uploadId',
|
705 |
-
'response-content-type',
|
706 |
-
'response-content-language',
|
707 |
-
'response-expires',
|
708 |
-
'response-cache-control',
|
709 |
-
'response-content-disposition',
|
710 |
-
'response-content-encoding',
|
711 |
-
'delete',
|
712 |
-
'lifecycle',
|
713 |
-
'tagging',
|
714 |
-
'restore',
|
715 |
-
'storageClass',
|
716 |
-
'notification',
|
717 |
-
'replication',
|
718 |
-
'requestPayment',
|
719 |
-
'analytics',
|
720 |
-
'metrics',
|
721 |
-
'inventory',
|
722 |
-
'select',
|
723 |
-
'select-type',
|
724 |
-
'object-lock',
|
725 |
-
]
|
726 |
-
|
727 |
-
def __init__(self, credentials, service_name=None, region_name=None):
|
728 |
-
self.credentials = credentials
|
729 |
-
|
730 |
-
def sign_string(self, string_to_sign):
|
731 |
-
new_hmac = hmac.new(
|
732 |
-
self.credentials.secret_key.encode('utf-8'), digestmod=sha1
|
733 |
-
)
|
734 |
-
new_hmac.update(string_to_sign.encode('utf-8'))
|
735 |
-
return encodebytes(new_hmac.digest()).strip().decode('utf-8')
|
736 |
-
|
737 |
-
def canonical_standard_headers(self, headers):
|
738 |
-
interesting_headers = ['content-md5', 'content-type', 'date']
|
739 |
-
hoi = []
|
740 |
-
if 'Date' in headers:
|
741 |
-
del headers['Date']
|
742 |
-
headers['Date'] = self._get_date()
|
743 |
-
for ih in interesting_headers:
|
744 |
-
found = False
|
745 |
-
for key in headers:
|
746 |
-
lk = key.lower()
|
747 |
-
if headers[key] is not None and lk == ih:
|
748 |
-
hoi.append(headers[key].strip())
|
749 |
-
found = True
|
750 |
-
if not found:
|
751 |
-
hoi.append('')
|
752 |
-
return '\n'.join(hoi)
|
753 |
-
|
754 |
-
def canonical_custom_headers(self, headers):
|
755 |
-
hoi = []
|
756 |
-
custom_headers = {}
|
757 |
-
for key in headers:
|
758 |
-
lk = key.lower()
|
759 |
-
if headers[key] is not None:
|
760 |
-
if lk.startswith('x-amz-'):
|
761 |
-
custom_headers[lk] = ','.join(
|
762 |
-
v.strip() for v in headers.get_all(key)
|
763 |
-
)
|
764 |
-
sorted_header_keys = sorted(custom_headers.keys())
|
765 |
-
for key in sorted_header_keys:
|
766 |
-
hoi.append(f"{key}:{custom_headers[key]}")
|
767 |
-
return '\n'.join(hoi)
|
768 |
-
|
769 |
-
def unquote_v(self, nv):
|
770 |
-
"""
|
771 |
-
TODO: Do we need this?
|
772 |
-
"""
|
773 |
-
if len(nv) == 1:
|
774 |
-
return nv
|
775 |
-
else:
|
776 |
-
return (nv[0], unquote(nv[1]))
|
777 |
-
|
778 |
-
def canonical_resource(self, split, auth_path=None):
|
779 |
-
# don't include anything after the first ? in the resource...
|
780 |
-
# unless it is one of the QSA of interest, defined above
|
781 |
-
# NOTE:
|
782 |
-
# The path in the canonical resource should always be the
|
783 |
-
# full path including the bucket name, even for virtual-hosting
|
784 |
-
# style addressing. The ``auth_path`` keeps track of the full
|
785 |
-
# path for the canonical resource and would be passed in if
|
786 |
-
# the client was using virtual-hosting style.
|
787 |
-
if auth_path is not None:
|
788 |
-
buf = auth_path
|
789 |
-
else:
|
790 |
-
buf = split.path
|
791 |
-
if split.query:
|
792 |
-
qsa = split.query.split('&')
|
793 |
-
qsa = [a.split('=', 1) for a in qsa]
|
794 |
-
qsa = [
|
795 |
-
self.unquote_v(a) for a in qsa if a[0] in self.QSAOfInterest
|
796 |
-
]
|
797 |
-
if len(qsa) > 0:
|
798 |
-
qsa.sort(key=itemgetter(0))
|
799 |
-
qsa = ['='.join(a) for a in qsa]
|
800 |
-
buf += '?'
|
801 |
-
buf += '&'.join(qsa)
|
802 |
-
return buf
|
803 |
-
|
804 |
-
def canonical_string(
|
805 |
-
self, method, split, headers, expires=None, auth_path=None
|
806 |
-
):
|
807 |
-
cs = method.upper() + '\n'
|
808 |
-
cs += self.canonical_standard_headers(headers) + '\n'
|
809 |
-
custom_headers = self.canonical_custom_headers(headers)
|
810 |
-
if custom_headers:
|
811 |
-
cs += custom_headers + '\n'
|
812 |
-
cs += self.canonical_resource(split, auth_path=auth_path)
|
813 |
-
return cs
|
814 |
-
|
815 |
-
def get_signature(
|
816 |
-
self, method, split, headers, expires=None, auth_path=None
|
817 |
-
):
|
818 |
-
if self.credentials.token:
|
819 |
-
del headers['x-amz-security-token']
|
820 |
-
headers['x-amz-security-token'] = self.credentials.token
|
821 |
-
string_to_sign = self.canonical_string(
|
822 |
-
method, split, headers, auth_path=auth_path
|
823 |
-
)
|
824 |
-
logger.debug('StringToSign:\n%s', string_to_sign)
|
825 |
-
return self.sign_string(string_to_sign)
|
826 |
-
|
827 |
-
def add_auth(self, request):
|
828 |
-
if self.credentials is None:
|
829 |
-
raise NoCredentialsError
|
830 |
-
logger.debug("Calculating signature using hmacv1 auth.")
|
831 |
-
split = urlsplit(request.url)
|
832 |
-
logger.debug('HTTP request method: %s', request.method)
|
833 |
-
signature = self.get_signature(
|
834 |
-
request.method, split, request.headers, auth_path=request.auth_path
|
835 |
-
)
|
836 |
-
self._inject_signature(request, signature)
|
837 |
-
|
838 |
-
def _get_date(self):
|
839 |
-
return formatdate(usegmt=True)
|
840 |
-
|
841 |
-
def _inject_signature(self, request, signature):
|
842 |
-
if 'Authorization' in request.headers:
|
843 |
-
# We have to do this because request.headers is not
|
844 |
-
# normal dictionary. It has the (unintuitive) behavior
|
845 |
-
# of aggregating repeated setattr calls for the same
|
846 |
-
# key value. For example:
|
847 |
-
# headers['foo'] = 'a'; headers['foo'] = 'b'
|
848 |
-
# list(headers) will print ['foo', 'foo'].
|
849 |
-
del request.headers['Authorization']
|
850 |
-
|
851 |
-
auth_header = f"AWS {self.credentials.access_key}:{signature}"
|
852 |
-
request.headers['Authorization'] = auth_header
|
853 |
-
|
854 |
-
|
855 |
-
class HmacV1QueryAuth(HmacV1Auth):
|
856 |
-
"""
|
857 |
-
Generates a presigned request for s3.
|
858 |
-
|
859 |
-
Spec from this document:
|
860 |
-
|
861 |
-
http://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html
|
862 |
-
#RESTAuthenticationQueryStringAuth
|
863 |
-
|
864 |
-
"""
|
865 |
-
|
866 |
-
DEFAULT_EXPIRES = 3600
|
867 |
-
|
868 |
-
def __init__(self, credentials, expires=DEFAULT_EXPIRES):
|
869 |
-
self.credentials = credentials
|
870 |
-
self._expires = expires
|
871 |
-
|
872 |
-
def _get_date(self):
|
873 |
-
return str(int(time.time() + int(self._expires)))
|
874 |
-
|
875 |
-
def _inject_signature(self, request, signature):
|
876 |
-
query_dict = {}
|
877 |
-
query_dict['AWSAccessKeyId'] = self.credentials.access_key
|
878 |
-
query_dict['Signature'] = signature
|
879 |
-
|
880 |
-
for header_key in request.headers:
|
881 |
-
lk = header_key.lower()
|
882 |
-
# For query string requests, Expires is used instead of the
|
883 |
-
# Date header.
|
884 |
-
if header_key == 'Date':
|
885 |
-
query_dict['Expires'] = request.headers['Date']
|
886 |
-
# We only want to include relevant headers in the query string.
|
887 |
-
# These can be anything that starts with x-amz, is Content-MD5,
|
888 |
-
# or is Content-Type.
|
889 |
-
elif lk.startswith('x-amz-') or lk in (
|
890 |
-
'content-md5',
|
891 |
-
'content-type',
|
892 |
-
):
|
893 |
-
query_dict[lk] = request.headers[lk]
|
894 |
-
# Combine all of the identified headers into an encoded
|
895 |
-
# query string
|
896 |
-
new_query_string = percent_encode_sequence(query_dict)
|
897 |
-
|
898 |
-
# Create a new url with the presigned url.
|
899 |
-
p = urlsplit(request.url)
|
900 |
-
if p[3]:
|
901 |
-
# If there was a pre-existing query string, we should
|
902 |
-
# add that back before injecting the new query string.
|
903 |
-
new_query_string = f'{p[3]}&{new_query_string}'
|
904 |
-
new_url_parts = (p[0], p[1], p[2], new_query_string, p[4])
|
905 |
-
request.url = urlunsplit(new_url_parts)
|
906 |
-
|
907 |
-
|
908 |
-
class HmacV1PostAuth(HmacV1Auth):
|
909 |
-
"""
|
910 |
-
Generates a presigned post for s3.
|
911 |
-
|
912 |
-
Spec from this document:
|
913 |
-
|
914 |
-
http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingHTTPPOST.html
|
915 |
-
"""
|
916 |
-
|
917 |
-
def add_auth(self, request):
|
918 |
-
fields = {}
|
919 |
-
if request.context.get('s3-presign-post-fields', None) is not None:
|
920 |
-
fields = request.context['s3-presign-post-fields']
|
921 |
-
|
922 |
-
policy = {}
|
923 |
-
conditions = []
|
924 |
-
if request.context.get('s3-presign-post-policy', None) is not None:
|
925 |
-
policy = request.context['s3-presign-post-policy']
|
926 |
-
if policy.get('conditions', None) is not None:
|
927 |
-
conditions = policy['conditions']
|
928 |
-
|
929 |
-
policy['conditions'] = conditions
|
930 |
-
|
931 |
-
fields['AWSAccessKeyId'] = self.credentials.access_key
|
932 |
-
|
933 |
-
if self.credentials.token is not None:
|
934 |
-
fields['x-amz-security-token'] = self.credentials.token
|
935 |
-
conditions.append({'x-amz-security-token': self.credentials.token})
|
936 |
-
|
937 |
-
# Dump the base64 encoded policy into the fields dictionary.
|
938 |
-
fields['policy'] = base64.b64encode(
|
939 |
-
json.dumps(policy).encode('utf-8')
|
940 |
-
).decode('utf-8')
|
941 |
-
|
942 |
-
fields['signature'] = self.sign_string(fields['policy'])
|
943 |
-
|
944 |
-
request.context['s3-presign-post-fields'] = fields
|
945 |
-
request.context['s3-presign-post-policy'] = policy
|
946 |
-
|
947 |
-
|
948 |
-
class BearerAuth(TokenSigner):
|
949 |
-
"""
|
950 |
-
Performs bearer token authorization by placing the bearer token in the
|
951 |
-
Authorization header as specified by Section 2.1 of RFC 6750.
|
952 |
-
|
953 |
-
https://datatracker.ietf.org/doc/html/rfc6750#section-2.1
|
954 |
-
"""
|
955 |
-
|
956 |
-
def add_auth(self, request):
|
957 |
-
if self.auth_token is None:
|
958 |
-
raise NoAuthTokenError()
|
959 |
-
|
960 |
-
auth_header = f'Bearer {self.auth_token.token}'
|
961 |
-
if 'Authorization' in request.headers:
|
962 |
-
del request.headers['Authorization']
|
963 |
-
request.headers['Authorization'] = auth_header
|
964 |
-
|
965 |
-
|
966 |
-
AUTH_TYPE_MAPS = {
|
967 |
-
'v2': SigV2Auth,
|
968 |
-
'v3': SigV3Auth,
|
969 |
-
'v3https': SigV3Auth,
|
970 |
-
's3': HmacV1Auth,
|
971 |
-
's3-query': HmacV1QueryAuth,
|
972 |
-
's3-presign-post': HmacV1PostAuth,
|
973 |
-
's3v4-presign-post': S3SigV4PostAuth,
|
974 |
-
'bearer': BearerAuth,
|
975 |
-
}
|
976 |
-
|
977 |
-
# Define v4 signers depending on if CRT is present
|
978 |
-
if HAS_CRT:
|
979 |
-
from botocore.crt.auth import CRT_AUTH_TYPE_MAPS
|
980 |
-
|
981 |
-
AUTH_TYPE_MAPS.update(CRT_AUTH_TYPE_MAPS)
|
982 |
-
else:
|
983 |
-
AUTH_TYPE_MAPS.update(
|
984 |
-
{
|
985 |
-
'v4': SigV4Auth,
|
986 |
-
'v4-query': SigV4QueryAuth,
|
987 |
-
's3v4': S3SigV4Auth,
|
988 |
-
's3v4-query': S3SigV4QueryAuth,
|
989 |
-
}
|
990 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Big-Web/MMSD/env/Lib/site-packages/pip/_vendor/rich/palette.py
DELETED
@@ -1,100 +0,0 @@
|
|
1 |
-
from math import sqrt
|
2 |
-
from functools import lru_cache
|
3 |
-
from typing import Sequence, Tuple, TYPE_CHECKING
|
4 |
-
|
5 |
-
from .color_triplet import ColorTriplet
|
6 |
-
|
7 |
-
if TYPE_CHECKING:
|
8 |
-
from pip._vendor.rich.table import Table
|
9 |
-
|
10 |
-
|
11 |
-
class Palette:
|
12 |
-
"""A palette of available colors."""
|
13 |
-
|
14 |
-
def __init__(self, colors: Sequence[Tuple[int, int, int]]):
|
15 |
-
self._colors = colors
|
16 |
-
|
17 |
-
def __getitem__(self, number: int) -> ColorTriplet:
|
18 |
-
return ColorTriplet(*self._colors[number])
|
19 |
-
|
20 |
-
def __rich__(self) -> "Table":
|
21 |
-
from pip._vendor.rich.color import Color
|
22 |
-
from pip._vendor.rich.style import Style
|
23 |
-
from pip._vendor.rich.text import Text
|
24 |
-
from pip._vendor.rich.table import Table
|
25 |
-
|
26 |
-
table = Table(
|
27 |
-
"index",
|
28 |
-
"RGB",
|
29 |
-
"Color",
|
30 |
-
title="Palette",
|
31 |
-
caption=f"{len(self._colors)} colors",
|
32 |
-
highlight=True,
|
33 |
-
caption_justify="right",
|
34 |
-
)
|
35 |
-
for index, color in enumerate(self._colors):
|
36 |
-
table.add_row(
|
37 |
-
str(index),
|
38 |
-
repr(color),
|
39 |
-
Text(" " * 16, style=Style(bgcolor=Color.from_rgb(*color))),
|
40 |
-
)
|
41 |
-
return table
|
42 |
-
|
43 |
-
# This is somewhat inefficient and needs caching
|
44 |
-
@lru_cache(maxsize=1024)
|
45 |
-
def match(self, color: Tuple[int, int, int]) -> int:
|
46 |
-
"""Find a color from a palette that most closely matches a given color.
|
47 |
-
|
48 |
-
Args:
|
49 |
-
color (Tuple[int, int, int]): RGB components in range 0 > 255.
|
50 |
-
|
51 |
-
Returns:
|
52 |
-
int: Index of closes matching color.
|
53 |
-
"""
|
54 |
-
red1, green1, blue1 = color
|
55 |
-
_sqrt = sqrt
|
56 |
-
get_color = self._colors.__getitem__
|
57 |
-
|
58 |
-
def get_color_distance(index: int) -> float:
|
59 |
-
"""Get the distance to a color."""
|
60 |
-
red2, green2, blue2 = get_color(index)
|
61 |
-
red_mean = (red1 + red2) // 2
|
62 |
-
red = red1 - red2
|
63 |
-
green = green1 - green2
|
64 |
-
blue = blue1 - blue2
|
65 |
-
return _sqrt(
|
66 |
-
(((512 + red_mean) * red * red) >> 8)
|
67 |
-
+ 4 * green * green
|
68 |
-
+ (((767 - red_mean) * blue * blue) >> 8)
|
69 |
-
)
|
70 |
-
|
71 |
-
min_index = min(range(len(self._colors)), key=get_color_distance)
|
72 |
-
return min_index
|
73 |
-
|
74 |
-
|
75 |
-
if __name__ == "__main__": # pragma: no cover
|
76 |
-
import colorsys
|
77 |
-
from typing import Iterable
|
78 |
-
from pip._vendor.rich.color import Color
|
79 |
-
from pip._vendor.rich.console import Console, ConsoleOptions
|
80 |
-
from pip._vendor.rich.segment import Segment
|
81 |
-
from pip._vendor.rich.style import Style
|
82 |
-
|
83 |
-
class ColorBox:
|
84 |
-
def __rich_console__(
|
85 |
-
self, console: Console, options: ConsoleOptions
|
86 |
-
) -> Iterable[Segment]:
|
87 |
-
height = console.size.height - 3
|
88 |
-
for y in range(0, height):
|
89 |
-
for x in range(options.max_width):
|
90 |
-
h = x / options.max_width
|
91 |
-
l = y / (height + 1)
|
92 |
-
r1, g1, b1 = colorsys.hls_to_rgb(h, l, 1.0)
|
93 |
-
r2, g2, b2 = colorsys.hls_to_rgb(h, l + (1 / height / 2), 1.0)
|
94 |
-
bgcolor = Color.from_rgb(r1 * 255, g1 * 255, b1 * 255)
|
95 |
-
color = Color.from_rgb(r2 * 255, g2 * 255, b2 * 255)
|
96 |
-
yield Segment("▄", Style(color=color, bgcolor=bgcolor))
|
97 |
-
yield Segment.line()
|
98 |
-
|
99 |
-
console = Console()
|
100 |
-
console.print(ColorBox())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Bostoncake/ChatAssistant/README.md
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
---
|
2 |
-
title: ChatAssistant
|
3 |
-
emoji: 💩
|
4 |
-
colorFrom: red
|
5 |
-
colorTo: pink
|
6 |
-
sdk: gradio
|
7 |
-
sdk_version: 3.22.1
|
8 |
-
app_file: app.py
|
9 |
-
pinned: false
|
10 |
-
license: apache-2.0
|
11 |
-
---
|
12 |
-
|
13 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/CVPR/Dual-Key_Backdoor_Attacks/datagen/detectron2/detectron2/export/caffe2_export.py
DELETED
@@ -1,204 +0,0 @@
|
|
1 |
-
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
|
2 |
-
|
3 |
-
import copy
|
4 |
-
import io
|
5 |
-
import logging
|
6 |
-
import numpy as np
|
7 |
-
from typing import List
|
8 |
-
import onnx
|
9 |
-
import torch
|
10 |
-
from caffe2.proto import caffe2_pb2
|
11 |
-
from caffe2.python import core
|
12 |
-
from caffe2.python.onnx.backend import Caffe2Backend
|
13 |
-
from tabulate import tabulate
|
14 |
-
from termcolor import colored
|
15 |
-
from torch.onnx import OperatorExportTypes
|
16 |
-
|
17 |
-
from .shared import (
|
18 |
-
ScopedWS,
|
19 |
-
construct_init_net_from_params,
|
20 |
-
fuse_alias_placeholder,
|
21 |
-
fuse_copy_between_cpu_and_gpu,
|
22 |
-
get_params_from_init_net,
|
23 |
-
group_norm_replace_aten_with_caffe2,
|
24 |
-
infer_device_type,
|
25 |
-
remove_dead_end_ops,
|
26 |
-
remove_reshape_for_fc,
|
27 |
-
save_graph,
|
28 |
-
)
|
29 |
-
|
30 |
-
logger = logging.getLogger(__name__)
|
31 |
-
|
32 |
-
|
33 |
-
def export_onnx_model(model, inputs):
|
34 |
-
"""
|
35 |
-
Trace and export a model to onnx format.
|
36 |
-
|
37 |
-
Args:
|
38 |
-
model (nn.Module):
|
39 |
-
inputs (tuple[args]): the model will be called by `model(*inputs)`
|
40 |
-
|
41 |
-
Returns:
|
42 |
-
an onnx model
|
43 |
-
"""
|
44 |
-
assert isinstance(model, torch.nn.Module)
|
45 |
-
|
46 |
-
# make sure all modules are in eval mode, onnx may change the training state
|
47 |
-
# of the module if the states are not consistent
|
48 |
-
def _check_eval(module):
|
49 |
-
assert not module.training
|
50 |
-
|
51 |
-
model.apply(_check_eval)
|
52 |
-
|
53 |
-
# Export the model to ONNX
|
54 |
-
with torch.no_grad():
|
55 |
-
with io.BytesIO() as f:
|
56 |
-
torch.onnx.export(
|
57 |
-
model,
|
58 |
-
inputs,
|
59 |
-
f,
|
60 |
-
operator_export_type=OperatorExportTypes.ONNX_ATEN_FALLBACK,
|
61 |
-
# verbose=True, # NOTE: uncomment this for debugging
|
62 |
-
# export_params=True,
|
63 |
-
)
|
64 |
-
onnx_model = onnx.load_from_string(f.getvalue())
|
65 |
-
|
66 |
-
# Apply ONNX's Optimization
|
67 |
-
all_passes = onnx.optimizer.get_available_passes()
|
68 |
-
passes = ["fuse_bn_into_conv"]
|
69 |
-
assert all(p in all_passes for p in passes)
|
70 |
-
onnx_model = onnx.optimizer.optimize(onnx_model, passes)
|
71 |
-
return onnx_model
|
72 |
-
|
73 |
-
|
74 |
-
def _op_stats(net_def):
|
75 |
-
type_count = {}
|
76 |
-
for t in [op.type for op in net_def.op]:
|
77 |
-
type_count[t] = type_count.get(t, 0) + 1
|
78 |
-
type_count_list = sorted(type_count.items(), key=lambda kv: kv[0]) # alphabet
|
79 |
-
type_count_list = sorted(type_count_list, key=lambda kv: -kv[1]) # count
|
80 |
-
return "\n".join("{:>4}x {}".format(count, name) for name, count in type_count_list)
|
81 |
-
|
82 |
-
|
83 |
-
def _assign_device_option(
|
84 |
-
predict_net: caffe2_pb2.NetDef, init_net: caffe2_pb2.NetDef, tensor_inputs: List[torch.Tensor]
|
85 |
-
):
|
86 |
-
"""
|
87 |
-
ONNX exported network doesn't have concept of device, assign necessary
|
88 |
-
device option for each op in order to make it runable on GPU runtime.
|
89 |
-
"""
|
90 |
-
|
91 |
-
def _get_device_type(torch_tensor):
|
92 |
-
assert torch_tensor.device.type in ["cpu", "cuda"]
|
93 |
-
assert torch_tensor.device.index == 0
|
94 |
-
return torch_tensor.device.type
|
95 |
-
|
96 |
-
def _assign_op_device_option(net_proto, net_ssa, blob_device_types):
|
97 |
-
for op, ssa_i in zip(net_proto.op, net_ssa):
|
98 |
-
if op.type in ["CopyCPUToGPU", "CopyGPUToCPU"]:
|
99 |
-
op.device_option.CopyFrom(core.DeviceOption(caffe2_pb2.CUDA, 0))
|
100 |
-
else:
|
101 |
-
devices = [blob_device_types[b] for b in ssa_i[0] + ssa_i[1]]
|
102 |
-
assert all(d == devices[0] for d in devices)
|
103 |
-
if devices[0] == "cuda":
|
104 |
-
op.device_option.CopyFrom(core.DeviceOption(caffe2_pb2.CUDA, 0))
|
105 |
-
|
106 |
-
# update ops in predict_net
|
107 |
-
predict_net_input_device_types = {
|
108 |
-
(name, 0): _get_device_type(tensor)
|
109 |
-
for name, tensor in zip(predict_net.external_input, tensor_inputs)
|
110 |
-
}
|
111 |
-
predict_net_device_types = infer_device_type(
|
112 |
-
predict_net, known_status=predict_net_input_device_types, device_name_style="pytorch"
|
113 |
-
)
|
114 |
-
predict_net_ssa, _ = core.get_ssa(predict_net)
|
115 |
-
_assign_op_device_option(predict_net, predict_net_ssa, predict_net_device_types)
|
116 |
-
|
117 |
-
# update ops in init_net
|
118 |
-
init_net_ssa, versions = core.get_ssa(init_net)
|
119 |
-
init_net_output_device_types = {
|
120 |
-
(name, versions[name]): predict_net_device_types[(name, 0)]
|
121 |
-
for name in init_net.external_output
|
122 |
-
}
|
123 |
-
init_net_device_types = infer_device_type(
|
124 |
-
init_net, known_status=init_net_output_device_types, device_name_style="pytorch"
|
125 |
-
)
|
126 |
-
_assign_op_device_option(init_net, init_net_ssa, init_net_device_types)
|
127 |
-
|
128 |
-
|
129 |
-
def export_caffe2_detection_model(model: torch.nn.Module, tensor_inputs: List[torch.Tensor]):
|
130 |
-
"""
|
131 |
-
Export a caffe2-compatible Detectron2 model to caffe2 format via ONNX.
|
132 |
-
|
133 |
-
Arg:
|
134 |
-
model: a caffe2-compatible version of detectron2 model, defined in caffe2_modeling.py
|
135 |
-
tensor_inputs: a list of tensors that caffe2 model takes as input.
|
136 |
-
"""
|
137 |
-
model = copy.deepcopy(model)
|
138 |
-
assert isinstance(model, torch.nn.Module)
|
139 |
-
assert hasattr(model, "encode_additional_info")
|
140 |
-
|
141 |
-
# Export via ONNX
|
142 |
-
logger.info("Exporting a {} model via ONNX ...".format(type(model).__name__))
|
143 |
-
onnx_model = export_onnx_model(model, (tensor_inputs,))
|
144 |
-
# Convert ONNX model to Caffe2 protobuf
|
145 |
-
init_net, predict_net = Caffe2Backend.onnx_graph_to_caffe2_net(onnx_model)
|
146 |
-
ops_table = [[op.type, op.input, op.output] for op in predict_net.op]
|
147 |
-
table = tabulate(ops_table, headers=["type", "input", "output"], tablefmt="pipe")
|
148 |
-
logger.info(
|
149 |
-
"ONNX export Done. Exported predict_net (before optimizations):\n" + colored(table, "cyan")
|
150 |
-
)
|
151 |
-
|
152 |
-
# Apply protobuf optimization
|
153 |
-
fuse_alias_placeholder(predict_net, init_net)
|
154 |
-
if any(t.device.type != "cpu" for t in tensor_inputs):
|
155 |
-
fuse_copy_between_cpu_and_gpu(predict_net)
|
156 |
-
remove_dead_end_ops(init_net)
|
157 |
-
_assign_device_option(predict_net, init_net, tensor_inputs)
|
158 |
-
params, device_options = get_params_from_init_net(init_net)
|
159 |
-
predict_net, params = remove_reshape_for_fc(predict_net, params)
|
160 |
-
init_net = construct_init_net_from_params(params, device_options)
|
161 |
-
group_norm_replace_aten_with_caffe2(predict_net)
|
162 |
-
|
163 |
-
# Record necessary information for running the pb model in Detectron2 system.
|
164 |
-
model.encode_additional_info(predict_net, init_net)
|
165 |
-
|
166 |
-
logger.info("Operators used in predict_net: \n{}".format(_op_stats(predict_net)))
|
167 |
-
logger.info("Operators used in init_net: \n{}".format(_op_stats(init_net)))
|
168 |
-
|
169 |
-
return predict_net, init_net
|
170 |
-
|
171 |
-
|
172 |
-
def run_and_save_graph(predict_net, init_net, tensor_inputs, graph_save_path):
|
173 |
-
"""
|
174 |
-
Run the caffe2 model on given inputs, recording the shape and draw the graph.
|
175 |
-
|
176 |
-
predict_net/init_net: caffe2 model.
|
177 |
-
tensor_inputs: a list of tensors that caffe2 model takes as input.
|
178 |
-
graph_save_path: path for saving graph of exported model.
|
179 |
-
"""
|
180 |
-
|
181 |
-
logger.info("Saving graph of ONNX exported model to {} ...".format(graph_save_path))
|
182 |
-
save_graph(predict_net, graph_save_path, op_only=False)
|
183 |
-
|
184 |
-
# Run the exported Caffe2 net
|
185 |
-
logger.info("Running ONNX exported model ...")
|
186 |
-
with ScopedWS("__ws_tmp__", True) as ws:
|
187 |
-
ws.RunNetOnce(init_net)
|
188 |
-
initialized_blobs = set(ws.Blobs())
|
189 |
-
uninitialized = [inp for inp in predict_net.external_input if inp not in initialized_blobs]
|
190 |
-
for name, blob in zip(uninitialized, tensor_inputs):
|
191 |
-
ws.FeedBlob(name, blob)
|
192 |
-
|
193 |
-
try:
|
194 |
-
ws.RunNetOnce(predict_net)
|
195 |
-
except RuntimeError as e:
|
196 |
-
logger.warning("Encountered RuntimeError: \n{}".format(str(e)))
|
197 |
-
|
198 |
-
ws_blobs = {b: ws.FetchBlob(b) for b in ws.Blobs()}
|
199 |
-
blob_sizes = {b: ws_blobs[b].shape for b in ws_blobs if isinstance(ws_blobs[b], np.ndarray)}
|
200 |
-
|
201 |
-
logger.info("Saving graph with blob shapes to {} ...".format(graph_save_path))
|
202 |
-
save_graph(predict_net, graph_save_path, op_only=False, blob_sizes=blob_sizes)
|
203 |
-
|
204 |
-
return ws_blobs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/CVPR/LIVE/pybind11/tests/test_stl.py
DELETED
@@ -1,252 +0,0 @@
|
|
1 |
-
# -*- coding: utf-8 -*-
|
2 |
-
import pytest
|
3 |
-
|
4 |
-
from pybind11_tests import stl as m
|
5 |
-
from pybind11_tests import UserType
|
6 |
-
from pybind11_tests import ConstructorStats
|
7 |
-
|
8 |
-
|
9 |
-
def test_vector(doc):
|
10 |
-
"""std::vector <-> list"""
|
11 |
-
lst = m.cast_vector()
|
12 |
-
assert lst == [1]
|
13 |
-
lst.append(2)
|
14 |
-
assert m.load_vector(lst)
|
15 |
-
assert m.load_vector(tuple(lst))
|
16 |
-
|
17 |
-
assert m.cast_bool_vector() == [True, False]
|
18 |
-
assert m.load_bool_vector([True, False])
|
19 |
-
|
20 |
-
assert doc(m.cast_vector) == "cast_vector() -> List[int]"
|
21 |
-
assert doc(m.load_vector) == "load_vector(arg0: List[int]) -> bool"
|
22 |
-
|
23 |
-
# Test regression caused by 936: pointers to stl containers weren't castable
|
24 |
-
assert m.cast_ptr_vector() == ["lvalue", "lvalue"]
|
25 |
-
|
26 |
-
|
27 |
-
def test_deque(doc):
|
28 |
-
"""std::deque <-> list"""
|
29 |
-
lst = m.cast_deque()
|
30 |
-
assert lst == [1]
|
31 |
-
lst.append(2)
|
32 |
-
assert m.load_deque(lst)
|
33 |
-
assert m.load_deque(tuple(lst))
|
34 |
-
|
35 |
-
|
36 |
-
def test_array(doc):
|
37 |
-
"""std::array <-> list"""
|
38 |
-
lst = m.cast_array()
|
39 |
-
assert lst == [1, 2]
|
40 |
-
assert m.load_array(lst)
|
41 |
-
|
42 |
-
assert doc(m.cast_array) == "cast_array() -> List[int[2]]"
|
43 |
-
assert doc(m.load_array) == "load_array(arg0: List[int[2]]) -> bool"
|
44 |
-
|
45 |
-
|
46 |
-
def test_valarray(doc):
|
47 |
-
"""std::valarray <-> list"""
|
48 |
-
lst = m.cast_valarray()
|
49 |
-
assert lst == [1, 4, 9]
|
50 |
-
assert m.load_valarray(lst)
|
51 |
-
|
52 |
-
assert doc(m.cast_valarray) == "cast_valarray() -> List[int]"
|
53 |
-
assert doc(m.load_valarray) == "load_valarray(arg0: List[int]) -> bool"
|
54 |
-
|
55 |
-
|
56 |
-
def test_map(doc):
|
57 |
-
"""std::map <-> dict"""
|
58 |
-
d = m.cast_map()
|
59 |
-
assert d == {"key": "value"}
|
60 |
-
assert "key" in d
|
61 |
-
d["key2"] = "value2"
|
62 |
-
assert "key2" in d
|
63 |
-
assert m.load_map(d)
|
64 |
-
|
65 |
-
assert doc(m.cast_map) == "cast_map() -> Dict[str, str]"
|
66 |
-
assert doc(m.load_map) == "load_map(arg0: Dict[str, str]) -> bool"
|
67 |
-
|
68 |
-
|
69 |
-
def test_set(doc):
|
70 |
-
"""std::set <-> set"""
|
71 |
-
s = m.cast_set()
|
72 |
-
assert s == {"key1", "key2"}
|
73 |
-
s.add("key3")
|
74 |
-
assert m.load_set(s)
|
75 |
-
|
76 |
-
assert doc(m.cast_set) == "cast_set() -> Set[str]"
|
77 |
-
assert doc(m.load_set) == "load_set(arg0: Set[str]) -> bool"
|
78 |
-
|
79 |
-
|
80 |
-
def test_recursive_casting():
|
81 |
-
"""Tests that stl casters preserve lvalue/rvalue context for container values"""
|
82 |
-
assert m.cast_rv_vector() == ["rvalue", "rvalue"]
|
83 |
-
assert m.cast_lv_vector() == ["lvalue", "lvalue"]
|
84 |
-
assert m.cast_rv_array() == ["rvalue", "rvalue", "rvalue"]
|
85 |
-
assert m.cast_lv_array() == ["lvalue", "lvalue"]
|
86 |
-
assert m.cast_rv_map() == {"a": "rvalue"}
|
87 |
-
assert m.cast_lv_map() == {"a": "lvalue", "b": "lvalue"}
|
88 |
-
assert m.cast_rv_nested() == [[[{"b": "rvalue", "c": "rvalue"}], [{"a": "rvalue"}]]]
|
89 |
-
assert m.cast_lv_nested() == {
|
90 |
-
"a": [[["lvalue", "lvalue"]], [["lvalue", "lvalue"]]],
|
91 |
-
"b": [[["lvalue", "lvalue"], ["lvalue", "lvalue"]]]
|
92 |
-
}
|
93 |
-
|
94 |
-
# Issue #853 test case:
|
95 |
-
z = m.cast_unique_ptr_vector()
|
96 |
-
assert z[0].value == 7 and z[1].value == 42
|
97 |
-
|
98 |
-
|
99 |
-
def test_move_out_container():
|
100 |
-
"""Properties use the `reference_internal` policy by default. If the underlying function
|
101 |
-
returns an rvalue, the policy is automatically changed to `move` to avoid referencing
|
102 |
-
a temporary. In case the return value is a container of user-defined types, the policy
|
103 |
-
also needs to be applied to the elements, not just the container."""
|
104 |
-
c = m.MoveOutContainer()
|
105 |
-
moved_out_list = c.move_list
|
106 |
-
assert [x.value for x in moved_out_list] == [0, 1, 2]
|
107 |
-
|
108 |
-
|
109 |
-
@pytest.mark.skipif(not hasattr(m, "has_optional"), reason='no <optional>')
|
110 |
-
def test_optional():
|
111 |
-
assert m.double_or_zero(None) == 0
|
112 |
-
assert m.double_or_zero(42) == 84
|
113 |
-
pytest.raises(TypeError, m.double_or_zero, 'foo')
|
114 |
-
|
115 |
-
assert m.half_or_none(0) is None
|
116 |
-
assert m.half_or_none(42) == 21
|
117 |
-
pytest.raises(TypeError, m.half_or_none, 'foo')
|
118 |
-
|
119 |
-
assert m.test_nullopt() == 42
|
120 |
-
assert m.test_nullopt(None) == 42
|
121 |
-
assert m.test_nullopt(42) == 42
|
122 |
-
assert m.test_nullopt(43) == 43
|
123 |
-
|
124 |
-
assert m.test_no_assign() == 42
|
125 |
-
assert m.test_no_assign(None) == 42
|
126 |
-
assert m.test_no_assign(m.NoAssign(43)) == 43
|
127 |
-
pytest.raises(TypeError, m.test_no_assign, 43)
|
128 |
-
|
129 |
-
assert m.nodefer_none_optional(None)
|
130 |
-
|
131 |
-
holder = m.OptionalHolder()
|
132 |
-
mvalue = holder.member
|
133 |
-
assert mvalue.initialized
|
134 |
-
assert holder.member_initialized()
|
135 |
-
|
136 |
-
|
137 |
-
@pytest.mark.skipif(not hasattr(m, "has_exp_optional"), reason='no <experimental/optional>')
|
138 |
-
def test_exp_optional():
|
139 |
-
assert m.double_or_zero_exp(None) == 0
|
140 |
-
assert m.double_or_zero_exp(42) == 84
|
141 |
-
pytest.raises(TypeError, m.double_or_zero_exp, 'foo')
|
142 |
-
|
143 |
-
assert m.half_or_none_exp(0) is None
|
144 |
-
assert m.half_or_none_exp(42) == 21
|
145 |
-
pytest.raises(TypeError, m.half_or_none_exp, 'foo')
|
146 |
-
|
147 |
-
assert m.test_nullopt_exp() == 42
|
148 |
-
assert m.test_nullopt_exp(None) == 42
|
149 |
-
assert m.test_nullopt_exp(42) == 42
|
150 |
-
assert m.test_nullopt_exp(43) == 43
|
151 |
-
|
152 |
-
assert m.test_no_assign_exp() == 42
|
153 |
-
assert m.test_no_assign_exp(None) == 42
|
154 |
-
assert m.test_no_assign_exp(m.NoAssign(43)) == 43
|
155 |
-
pytest.raises(TypeError, m.test_no_assign_exp, 43)
|
156 |
-
|
157 |
-
holder = m.OptionalExpHolder()
|
158 |
-
mvalue = holder.member
|
159 |
-
assert mvalue.initialized
|
160 |
-
assert holder.member_initialized()
|
161 |
-
|
162 |
-
|
163 |
-
@pytest.mark.skipif(not hasattr(m, "load_variant"), reason='no <variant>')
|
164 |
-
def test_variant(doc):
|
165 |
-
assert m.load_variant(1) == "int"
|
166 |
-
assert m.load_variant("1") == "std::string"
|
167 |
-
assert m.load_variant(1.0) == "double"
|
168 |
-
assert m.load_variant(None) == "std::nullptr_t"
|
169 |
-
|
170 |
-
assert m.load_variant_2pass(1) == "int"
|
171 |
-
assert m.load_variant_2pass(1.0) == "double"
|
172 |
-
|
173 |
-
assert m.cast_variant() == (5, "Hello")
|
174 |
-
|
175 |
-
assert doc(m.load_variant) == "load_variant(arg0: Union[int, str, float, None]) -> str"
|
176 |
-
|
177 |
-
|
178 |
-
def test_vec_of_reference_wrapper():
|
179 |
-
"""#171: Can't return reference wrappers (or STL structures containing them)"""
|
180 |
-
assert str(m.return_vec_of_reference_wrapper(UserType(4))) == \
|
181 |
-
"[UserType(1), UserType(2), UserType(3), UserType(4)]"
|
182 |
-
|
183 |
-
|
184 |
-
def test_stl_pass_by_pointer(msg):
|
185 |
-
"""Passing nullptr or None to an STL container pointer is not expected to work"""
|
186 |
-
with pytest.raises(TypeError) as excinfo:
|
187 |
-
m.stl_pass_by_pointer() # default value is `nullptr`
|
188 |
-
assert msg(excinfo.value) == """
|
189 |
-
stl_pass_by_pointer(): incompatible function arguments. The following argument types are supported:
|
190 |
-
1. (v: List[int] = None) -> List[int]
|
191 |
-
|
192 |
-
Invoked with:
|
193 |
-
""" # noqa: E501 line too long
|
194 |
-
|
195 |
-
with pytest.raises(TypeError) as excinfo:
|
196 |
-
m.stl_pass_by_pointer(None)
|
197 |
-
assert msg(excinfo.value) == """
|
198 |
-
stl_pass_by_pointer(): incompatible function arguments. The following argument types are supported:
|
199 |
-
1. (v: List[int] = None) -> List[int]
|
200 |
-
|
201 |
-
Invoked with: None
|
202 |
-
""" # noqa: E501 line too long
|
203 |
-
|
204 |
-
assert m.stl_pass_by_pointer([1, 2, 3]) == [1, 2, 3]
|
205 |
-
|
206 |
-
|
207 |
-
def test_missing_header_message():
|
208 |
-
"""Trying convert `list` to a `std::vector`, or vice versa, without including
|
209 |
-
<pybind11/stl.h> should result in a helpful suggestion in the error message"""
|
210 |
-
import pybind11_cross_module_tests as cm
|
211 |
-
|
212 |
-
expected_message = ("Did you forget to `#include <pybind11/stl.h>`? Or <pybind11/complex.h>,\n"
|
213 |
-
"<pybind11/functional.h>, <pybind11/chrono.h>, etc. Some automatic\n"
|
214 |
-
"conversions are optional and require extra headers to be included\n"
|
215 |
-
"when compiling your pybind11 module.")
|
216 |
-
|
217 |
-
with pytest.raises(TypeError) as excinfo:
|
218 |
-
cm.missing_header_arg([1.0, 2.0, 3.0])
|
219 |
-
assert expected_message in str(excinfo.value)
|
220 |
-
|
221 |
-
with pytest.raises(TypeError) as excinfo:
|
222 |
-
cm.missing_header_return()
|
223 |
-
assert expected_message in str(excinfo.value)
|
224 |
-
|
225 |
-
|
226 |
-
def test_function_with_string_and_vector_string_arg():
|
227 |
-
"""Check if a string is NOT implicitly converted to a list, which was the
|
228 |
-
behavior before fix of issue #1258"""
|
229 |
-
assert m.func_with_string_or_vector_string_arg_overload(('A', 'B', )) == 2
|
230 |
-
assert m.func_with_string_or_vector_string_arg_overload(['A', 'B']) == 2
|
231 |
-
assert m.func_with_string_or_vector_string_arg_overload('A') == 3
|
232 |
-
|
233 |
-
|
234 |
-
def test_stl_ownership():
|
235 |
-
cstats = ConstructorStats.get(m.Placeholder)
|
236 |
-
assert cstats.alive() == 0
|
237 |
-
r = m.test_stl_ownership()
|
238 |
-
assert len(r) == 1
|
239 |
-
del r
|
240 |
-
assert cstats.alive() == 0
|
241 |
-
|
242 |
-
|
243 |
-
def test_array_cast_sequence():
|
244 |
-
assert m.array_cast_sequence((1, 2, 3)) == [1, 2, 3]
|
245 |
-
|
246 |
-
|
247 |
-
def test_issue_1561():
|
248 |
-
""" check fix for issue #1561 """
|
249 |
-
bar = m.Issue1561Outer()
|
250 |
-
bar.list = [m.Issue1561Inner('bar')]
|
251 |
-
bar.list
|
252 |
-
assert bar.list[0].data == 'bar'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/CVPR/LIVE/thrust/thrust/detail/functional/placeholder.h
DELETED
@@ -1,39 +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/detail/functional/actor.h>
|
21 |
-
#include <thrust/detail/functional/argument.h>
|
22 |
-
|
23 |
-
namespace thrust
|
24 |
-
{
|
25 |
-
namespace detail
|
26 |
-
{
|
27 |
-
namespace functional
|
28 |
-
{
|
29 |
-
|
30 |
-
template<unsigned int i>
|
31 |
-
struct placeholder
|
32 |
-
{
|
33 |
-
typedef actor<argument<i> > type;
|
34 |
-
};
|
35 |
-
|
36 |
-
} // end functional
|
37 |
-
} // end detail
|
38 |
-
} // end thrust
|
39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/CVPR/LIVE/thrust/thrust/scatter.h
DELETED
@@ -1,423 +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 |
-
|
18 |
-
/*! \file scatter.h
|
19 |
-
* \brief Irregular copying to a destination range
|
20 |
-
*/
|
21 |
-
|
22 |
-
#pragma once
|
23 |
-
|
24 |
-
#include <thrust/detail/config.h>
|
25 |
-
#include <thrust/detail/execution_policy.h>
|
26 |
-
|
27 |
-
namespace thrust
|
28 |
-
{
|
29 |
-
|
30 |
-
|
31 |
-
/*! \addtogroup scattering
|
32 |
-
* \ingroup copying
|
33 |
-
* \{
|
34 |
-
*/
|
35 |
-
|
36 |
-
|
37 |
-
/*! \p scatter copies elements from a source range into an output array
|
38 |
-
* according to a map. For each iterator \c i in the range [\p first, \p last),
|
39 |
-
* the value \c *i is assigned to <tt>output[*(map + (i - first))]</tt>. The
|
40 |
-
* output iterator must permit random access. If the same index
|
41 |
-
* appears more than once in the range <tt>[map, map + (last - first))</tt>,
|
42 |
-
* the result is undefined.
|
43 |
-
*
|
44 |
-
* The algorithm's execution is parallelized as determined by \p exec.
|
45 |
-
*
|
46 |
-
* \param exec The execution policy to use for parallelization.
|
47 |
-
* \param first Beginning of the sequence of values to scatter.
|
48 |
-
* \param last End of the sequence of values to scatter.
|
49 |
-
* \param map Beginning of the sequence of output indices.
|
50 |
-
* \param result Destination of the source elements.
|
51 |
-
*
|
52 |
-
* \tparam DerivedPolicy The name of the derived execution policy.
|
53 |
-
* \tparam InputIterator1 must be a model of <a href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a> and \c InputIterator1's \c value_type must be convertible to \c RandomAccessIterator's \c value_type.
|
54 |
-
* \tparam InputIterator2 must be a model of <a href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a> and \c InputIterator2's \c value_type must be convertible to \c RandomAccessIterator's \c difference_type.
|
55 |
-
* \tparam RandomAccessIterator must be a model of <a href="http://www.sgi.com/tech/stl/RandomAccessIterator.html">Random Access iterator</a>.
|
56 |
-
*
|
57 |
-
* \pre The iterator `result + i` shall not refer to any element referenced by any iterator `j` in the range `[first,last)` for all iterators `i` in the range `[map,map + (last - first))`.
|
58 |
-
*
|
59 |
-
* \pre The iterator `result + i` shall not refer to any element referenced by any iterator `j` in the range `[map,map + (last - first))` for all iterators `i` in the range `[map,map + (last - first))`.
|
60 |
-
*
|
61 |
-
* \pre The expression `result[*i]` shall be valid for all iterators in the range `[map,map + (last - first))`.
|
62 |
-
*
|
63 |
-
* The following code snippet demonstrates how to use \p scatter to
|
64 |
-
* reorder a range using the \p thrust::device execution policy for parallelization:
|
65 |
-
*
|
66 |
-
* \code
|
67 |
-
* #include <thrust/scatter.h>
|
68 |
-
* #include <thrust/device_vector.h>
|
69 |
-
* #include <thrust/execution_policy.h>
|
70 |
-
* ...
|
71 |
-
* // mark even indices with a 1; odd indices with a 0
|
72 |
-
* int values[10] = {1, 0, 1, 0, 1, 0, 1, 0, 1, 0};
|
73 |
-
* thrust::device_vector<int> d_values(values, values + 10);
|
74 |
-
*
|
75 |
-
* // scatter all even indices into the first half of the
|
76 |
-
* // range, and odd indices vice versa
|
77 |
-
* int map[10] = {0, 5, 1, 6, 2, 7, 3, 8, 4, 9};
|
78 |
-
* thrust::device_vector<int> d_map(map, map + 10);
|
79 |
-
*
|
80 |
-
* thrust::device_vector<int> d_output(10);
|
81 |
-
* thrust::scatter(thrust::device,
|
82 |
-
* d_values.begin(), d_values.end(),
|
83 |
-
* d_map.begin(), d_output.begin());
|
84 |
-
* // d_output is now {1, 1, 1, 1, 1, 0, 0, 0, 0, 0}
|
85 |
-
* \endcode
|
86 |
-
*
|
87 |
-
* \note \p scatter is the inverse of thrust::gather.
|
88 |
-
*/
|
89 |
-
template<typename DerivedPolicy,
|
90 |
-
typename InputIterator1,
|
91 |
-
typename InputIterator2,
|
92 |
-
typename RandomAccessIterator>
|
93 |
-
__host__ __device__
|
94 |
-
void scatter(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
|
95 |
-
InputIterator1 first,
|
96 |
-
InputIterator1 last,
|
97 |
-
InputIterator2 map,
|
98 |
-
RandomAccessIterator result);
|
99 |
-
|
100 |
-
|
101 |
-
/*! \p scatter copies elements from a source range into an output array
|
102 |
-
* according to a map. For each iterator \c i in the range [\p first, \p last),
|
103 |
-
* the value \c *i is assigned to <tt>output[*(map + (i - first))]</tt>. The
|
104 |
-
* output iterator must permit random access. If the same index
|
105 |
-
* appears more than once in the range <tt>[map, map + (last - first))</tt>,
|
106 |
-
* the result is undefined.
|
107 |
-
*
|
108 |
-
* \param first Beginning of the sequence of values to scatter.
|
109 |
-
* \param last End of the sequence of values to scatter.
|
110 |
-
* \param map Beginning of the sequence of output indices.
|
111 |
-
* \param result Destination of the source elements.
|
112 |
-
*
|
113 |
-
* \tparam InputIterator1 must be a model of <a href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a> and \c InputIterator1's \c value_type must be convertible to \c RandomAccessIterator's \c value_type.
|
114 |
-
* \tparam InputIterator2 must be a model of <a href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a> and \c InputIterator2's \c value_type must be convertible to \c RandomAccessIterator's \c difference_type.
|
115 |
-
* \tparam RandomAccessIterator must be a model of <a href="http://www.sgi.com/tech/stl/RandomAccessIterator.html">Random Access iterator</a>.
|
116 |
-
*
|
117 |
-
* \pre The iterator `result + i` shall not refer to any element referenced by any iterator `j` in the range `[first,last)` for all iterators `i` in the range `[map,map + (last - first))`.
|
118 |
-
*
|
119 |
-
* \pre The iterator `result + i` shall not refer to any element referenced by any iterator `j` in the range `[map,map + (last - first))` for all iterators `i` in the range `[map,map + (last - first))`.
|
120 |
-
*
|
121 |
-
* \pre The expression `result[*i]` shall be valid for all iterators in the range `[map,map + (last - first))`.
|
122 |
-
*
|
123 |
-
* The following code snippet demonstrates how to use \p scatter to
|
124 |
-
* reorder a range.
|
125 |
-
*
|
126 |
-
* \code
|
127 |
-
* #include <thrust/scatter.h>
|
128 |
-
* #include <thrust/device_vector.h>
|
129 |
-
* ...
|
130 |
-
* // mark even indices with a 1; odd indices with a 0
|
131 |
-
* int values[10] = {1, 0, 1, 0, 1, 0, 1, 0, 1, 0};
|
132 |
-
* thrust::device_vector<int> d_values(values, values + 10);
|
133 |
-
*
|
134 |
-
* // scatter all even indices into the first half of the
|
135 |
-
* // range, and odd indices vice versa
|
136 |
-
* int map[10] = {0, 5, 1, 6, 2, 7, 3, 8, 4, 9};
|
137 |
-
* thrust::device_vector<int> d_map(map, map + 10);
|
138 |
-
*
|
139 |
-
* thrust::device_vector<int> d_output(10);
|
140 |
-
* thrust::scatter(d_values.begin(), d_values.end(),
|
141 |
-
* d_map.begin(), d_output.begin());
|
142 |
-
* // d_output is now {1, 1, 1, 1, 1, 0, 0, 0, 0, 0}
|
143 |
-
* \endcode
|
144 |
-
*
|
145 |
-
* \note \p scatter is the inverse of thrust::gather.
|
146 |
-
*/
|
147 |
-
template<typename InputIterator1,
|
148 |
-
typename InputIterator2,
|
149 |
-
typename RandomAccessIterator>
|
150 |
-
void scatter(InputIterator1 first,
|
151 |
-
InputIterator1 last,
|
152 |
-
InputIterator2 map,
|
153 |
-
RandomAccessIterator result);
|
154 |
-
|
155 |
-
|
156 |
-
/*! \p scatter_if conditionally copies elements from a source range into an
|
157 |
-
* output array according to a map. For each iterator \c i in the
|
158 |
-
* range <tt>[first, last)</tt> such that <tt>*(stencil + (i - first))</tt> is
|
159 |
-
* true, the value \c *i is assigned to <tt>output[*(map + (i - first))]</tt>.
|
160 |
-
* The output iterator must permit random access. If the same index
|
161 |
-
* appears more than once in the range <tt>[map, map + (last - first))</tt>
|
162 |
-
* the result is undefined.
|
163 |
-
*
|
164 |
-
* The algorithm's execution is parallelized as determined by \p exec.
|
165 |
-
*
|
166 |
-
* \param exec The execution policy to use for parallelization.
|
167 |
-
* \param first Beginning of the sequence of values to scatter.
|
168 |
-
* \param last End of the sequence of values to scatter.
|
169 |
-
* \param map Beginning of the sequence of output indices.
|
170 |
-
* \param stencil Beginning of the sequence of predicate values.
|
171 |
-
* \param output Beginning of the destination range.
|
172 |
-
*
|
173 |
-
* \tparam DerivedPolicy The name of the derived execution policy.
|
174 |
-
* \tparam InputIterator1 must be a model of <a href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a> and \c InputIterator1's \c value_type must be convertible to \c RandomAccessIterator's \c value_type.
|
175 |
-
* \tparam InputIterator2 must be a model of <a href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a> and \c InputIterator2's \c value_type must be convertible to \c RandomAccessIterator's \c difference_type.
|
176 |
-
* \tparam InputIterator3 must be a model of <a href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a> and \c InputIterator3's \c value_type must be convertible to \c bool.
|
177 |
-
* \tparam RandomAccessIterator must be a model of <a href="http://www.sgi.com/tech/stl/RandomAccessIterator.html">Random Access iterator</a>.
|
178 |
-
*
|
179 |
-
* \pre The iterator `result + i` shall not refer to any element referenced by any iterator `j` in the range `[first,last)` for all iterators `i` in the range `[map,map + (last - first))`.
|
180 |
-
*
|
181 |
-
* \pre The iterator `result + i` shall not refer to any element referenced by any iterator `j` in the range `[map,map + (last - first))` for all iterators `i` in the range `[map,map + (last - first))`.
|
182 |
-
*
|
183 |
-
* \pre The iterator `result + i` shall not refer to any element referenced by any iterator `j` in the range `[stencil,stencil + (last - first))` for all iterators `i` in the range `[map,map + (last - first))`.
|
184 |
-
*
|
185 |
-
* \pre The expression `result[*i]` shall be valid for all iterators `i` in the range `[map,map + (last - first))` for which the following condition holds: `*(stencil + i) != false`.
|
186 |
-
*
|
187 |
-
* \code
|
188 |
-
* #include <thrust/scatter.h>
|
189 |
-
* #include <thrust/execution_policy.h>
|
190 |
-
* ...
|
191 |
-
* int V[8] = {10, 20, 30, 40, 50, 60, 70, 80};
|
192 |
-
* int M[8] = {0, 5, 1, 6, 2, 7, 3, 4};
|
193 |
-
* int S[8] = {1, 0, 1, 0, 1, 0, 1, 0};
|
194 |
-
* int D[8] = {0, 0, 0, 0, 0, 0, 0, 0};
|
195 |
-
*
|
196 |
-
* thrust::scatter_if(thrust::host, V, V + 8, M, S, D);
|
197 |
-
*
|
198 |
-
* // D contains [10, 30, 50, 70, 0, 0, 0, 0];
|
199 |
-
* \endcode
|
200 |
-
*
|
201 |
-
* \note \p scatter_if is the inverse of thrust::gather_if.
|
202 |
-
*/
|
203 |
-
template<typename DerivedPolicy,
|
204 |
-
typename InputIterator1,
|
205 |
-
typename InputIterator2,
|
206 |
-
typename InputIterator3,
|
207 |
-
typename RandomAccessIterator>
|
208 |
-
__host__ __device__
|
209 |
-
void scatter_if(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
|
210 |
-
InputIterator1 first,
|
211 |
-
InputIterator1 last,
|
212 |
-
InputIterator2 map,
|
213 |
-
InputIterator3 stencil,
|
214 |
-
RandomAccessIterator output);
|
215 |
-
|
216 |
-
|
217 |
-
/*! \p scatter_if conditionally copies elements from a source range into an
|
218 |
-
* output array according to a map. For each iterator \c i in the
|
219 |
-
* range <tt>[first, last)</tt> such that <tt>*(stencil + (i - first))</tt> is
|
220 |
-
* true, the value \c *i is assigned to <tt>output[*(map + (i - first))]</tt>.
|
221 |
-
* The output iterator must permit random access. If the same index
|
222 |
-
* appears more than once in the range <tt>[map, map + (last - first))</tt>
|
223 |
-
* the result is undefined.
|
224 |
-
*
|
225 |
-
* \param first Beginning of the sequence of values to scatter.
|
226 |
-
* \param last End of the sequence of values to scatter.
|
227 |
-
* \param map Beginning of the sequence of output indices.
|
228 |
-
* \param stencil Beginning of the sequence of predicate values.
|
229 |
-
* \param output Beginning of the destination range.
|
230 |
-
*
|
231 |
-
* \tparam InputIterator1 must be a model of <a href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a> and \c InputIterator1's \c value_type must be convertible to \c RandomAccessIterator's \c value_type.
|
232 |
-
* \tparam InputIterator2 must be a model of <a href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a> and \c InputIterator2's \c value_type must be convertible to \c RandomAccessIterator's \c difference_type.
|
233 |
-
* \tparam InputIterator3 must be a model of <a href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a> and \c InputIterator3's \c value_type must be convertible to \c bool.
|
234 |
-
* \tparam RandomAccessIterator must be a model of <a href="http://www.sgi.com/tech/stl/RandomAccessIterator.html">Random Access iterator</a>.
|
235 |
-
*
|
236 |
-
* \pre The iterator `result + i` shall not refer to any element referenced by any iterator `j` in the range `[first,last)` for all iterators `i` in the range `[map,map + (last - first))`.
|
237 |
-
*
|
238 |
-
* \pre The iterator `result + i` shall not refer to any element referenced by any iterator `j` in the range `[map,map + (last - first))` for all iterators `i` in the range `[map,map + (last - first))`.
|
239 |
-
*
|
240 |
-
* \pre The iterator `result + i` shall not refer to any element referenced by any iterator `j` in the range `[stencil,stencil + (last - first))` for all iterators `i` in the range `[map,map + (last - first))`.
|
241 |
-
*
|
242 |
-
* \pre The expression `result[*i]` shall be valid for all iterators `i` in the range `[map,map + (last - first))` for which the following condition holds: `*(stencil + i) != false`.
|
243 |
-
*
|
244 |
-
* \code
|
245 |
-
* #include <thrust/scatter.h>
|
246 |
-
* ...
|
247 |
-
* int V[8] = {10, 20, 30, 40, 50, 60, 70, 80};
|
248 |
-
* int M[8] = {0, 5, 1, 6, 2, 7, 3, 4};
|
249 |
-
* int S[8] = {1, 0, 1, 0, 1, 0, 1, 0};
|
250 |
-
* int D[8] = {0, 0, 0, 0, 0, 0, 0, 0};
|
251 |
-
*
|
252 |
-
* thrust::scatter_if(V, V + 8, M, S, D);
|
253 |
-
*
|
254 |
-
* // D contains [10, 30, 50, 70, 0, 0, 0, 0];
|
255 |
-
* \endcode
|
256 |
-
*
|
257 |
-
* \note \p scatter_if is the inverse of thrust::gather_if.
|
258 |
-
*/
|
259 |
-
template<typename InputIterator1,
|
260 |
-
typename InputIterator2,
|
261 |
-
typename InputIterator3,
|
262 |
-
typename RandomAccessIterator>
|
263 |
-
void scatter_if(InputIterator1 first,
|
264 |
-
InputIterator1 last,
|
265 |
-
InputIterator2 map,
|
266 |
-
InputIterator3 stencil,
|
267 |
-
RandomAccessIterator output);
|
268 |
-
|
269 |
-
|
270 |
-
/*! \p scatter_if conditionally copies elements from a source range into an
|
271 |
-
* output array according to a map. For each iterator \c i in the
|
272 |
-
* range <tt>[first, last)</tt> such that <tt>pred(*(stencil + (i - first)))</tt> is
|
273 |
-
* \c true, the value \c *i is assigned to <tt>output[*(map + (i - first))]</tt>.
|
274 |
-
* The output iterator must permit random access. If the same index
|
275 |
-
* appears more than once in the range <tt>[map, map + (last - first))</tt>
|
276 |
-
* the result is undefined.
|
277 |
-
*
|
278 |
-
* The algorithm's execution is parallelized as determined by \p exec.
|
279 |
-
*
|
280 |
-
* \param exec The execution policy to use for parallelization.
|
281 |
-
* \param first Beginning of the sequence of values to scatter.
|
282 |
-
* \param last End of the sequence of values to scatter.
|
283 |
-
* \param map Beginning of the sequence of output indices.
|
284 |
-
* \param stencil Beginning of the sequence of predicate values.
|
285 |
-
* \param output Beginning of the destination range.
|
286 |
-
* \param pred Predicate to apply to the stencil values.
|
287 |
-
*
|
288 |
-
* \tparam DerivedPolicy The name of the derived execution policy.
|
289 |
-
* \tparam InputIterator1 must be a model of <a href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a> and \c InputIterator1's \c value_type must be convertible to \c RandomAccessIterator's \c value_type.
|
290 |
-
* \tparam InputIterator2 must be a model of <a href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a> and \c InputIterator2's \c value_type must be convertible to \c RandomAccessIterator's \c difference_type.
|
291 |
-
* \tparam InputIterator3 must be a model of <a href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a> and \c InputIterator3's \c value_type must be convertible to \c Predicate's \c argument_type.
|
292 |
-
* \tparam RandomAccessIterator must be a model of <a href="http://www.sgi.com/tech/stl/RandomAccessIterator.html">Random Access iterator</a>.
|
293 |
-
* \tparam Predicate must be a model of <a href="http://www.sgi.com/tech/stl/Predicate.html">Predicate</a>.
|
294 |
-
*
|
295 |
-
* \pre The iterator `result + i` shall not refer to any element referenced by any iterator `j` in the range `[first,last)` for all iterators `i` in the range `[map,map + (last - first))`.
|
296 |
-
*
|
297 |
-
* \pre The iterator `result + i` shall not refer to any element referenced by any iterator `j` in the range `[map,map + (last - first))` for all iterators `i` in the range `[map,map + (last - first))`.
|
298 |
-
*
|
299 |
-
* \pre The iterator `result + i` shall not refer to any element referenced by any iterator `j` in the range `[stencil,stencil + (last - first))` for all iterators `i` in the range `[map,map + (last - first))`.
|
300 |
-
*
|
301 |
-
* \pre The expression `result[*i]` shall be valid for all iterators `i` in the range `[map,map + (last - first))` for which the following condition holds: `pred(*(stencil + i)) != false`.
|
302 |
-
*
|
303 |
-
* \code
|
304 |
-
* #include <thrust/scatter.h>
|
305 |
-
* #include <thrust/execution_policy.h>
|
306 |
-
*
|
307 |
-
* struct is_even
|
308 |
-
* {
|
309 |
-
* __host__ __device__
|
310 |
-
* bool operator()(int x)
|
311 |
-
* {
|
312 |
-
* return (x % 2) == 0;
|
313 |
-
* }
|
314 |
-
* };
|
315 |
-
*
|
316 |
-
* ...
|
317 |
-
*
|
318 |
-
* int V[8] = {10, 20, 30, 40, 50, 60, 70, 80};
|
319 |
-
* int M[8] = {0, 5, 1, 6, 2, 7, 3, 4};
|
320 |
-
* int S[8] = {2, 1, 2, 1, 2, 1, 2, 1};
|
321 |
-
* int D[8] = {0, 0, 0, 0, 0, 0, 0, 0};
|
322 |
-
*
|
323 |
-
* is_even pred;
|
324 |
-
* thrust::scatter_if(thrust::host, V, V + 8, M, S, D, pred);
|
325 |
-
*
|
326 |
-
* // D contains [10, 30, 50, 70, 0, 0, 0, 0];
|
327 |
-
* \endcode
|
328 |
-
*
|
329 |
-
* \note \p scatter_if is the inverse of thrust::gather_if.
|
330 |
-
*/
|
331 |
-
template<typename DerivedPolicy,
|
332 |
-
typename InputIterator1,
|
333 |
-
typename InputIterator2,
|
334 |
-
typename InputIterator3,
|
335 |
-
typename RandomAccessIterator,
|
336 |
-
typename Predicate>
|
337 |
-
__host__ __device__
|
338 |
-
void scatter_if(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
|
339 |
-
InputIterator1 first,
|
340 |
-
InputIterator1 last,
|
341 |
-
InputIterator2 map,
|
342 |
-
InputIterator3 stencil,
|
343 |
-
RandomAccessIterator output,
|
344 |
-
Predicate pred);
|
345 |
-
|
346 |
-
|
347 |
-
/*! \p scatter_if conditionally copies elements from a source range into an
|
348 |
-
* output array according to a map. For each iterator \c i in the
|
349 |
-
* range <tt>[first, last)</tt> such that <tt>pred(*(stencil + (i - first)))</tt> is
|
350 |
-
* \c true, the value \c *i is assigned to <tt>output[*(map + (i - first))]</tt>.
|
351 |
-
* The output iterator must permit random access. If the same index
|
352 |
-
* appears more than once in the range <tt>[map, map + (last - first))</tt>
|
353 |
-
* the result is undefined.
|
354 |
-
*
|
355 |
-
* \param first Beginning of the sequence of values to scatter.
|
356 |
-
* \param last End of the sequence of values to scatter.
|
357 |
-
* \param map Beginning of the sequence of output indices.
|
358 |
-
* \param stencil Beginning of the sequence of predicate values.
|
359 |
-
* \param output Beginning of the destination range.
|
360 |
-
* \param pred Predicate to apply to the stencil values.
|
361 |
-
*
|
362 |
-
* \tparam InputIterator1 must be a model of <a href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a> and \c InputIterator1's \c value_type must be convertible to \c RandomAccessIterator's \c value_type.
|
363 |
-
* \tparam InputIterator2 must be a model of <a href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a> and \c InputIterator2's \c value_type must be convertible to \c RandomAccessIterator's \c difference_type.
|
364 |
-
* \tparam InputIterator3 must be a model of <a href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a> and \c InputIterator3's \c value_type must be convertible to \c Predicate's \c argument_type.
|
365 |
-
* \tparam RandomAccessIterator must be a model of <a href="http://www.sgi.com/tech/stl/RandomAccessIterator.html">Random Access iterator</a>.
|
366 |
-
* \tparam Predicate must be a model of <a href="http://www.sgi.com/tech/stl/Predicate.html">Predicate</a>.
|
367 |
-
*
|
368 |
-
* \pre The iterator `result + i` shall not refer to any element referenced by any iterator `j` in the range `[first,last)` for all iterators `i` in the range `[map,map + (last - first))`.
|
369 |
-
*
|
370 |
-
* \pre The iterator `result + i` shall not refer to any element referenced by any iterator `j` in the range `[map,map + (last - first))` for all iterators `i` in the range `[map,map + (last - first))`.
|
371 |
-
*
|
372 |
-
* \pre The iterator `result + i` shall not refer to any element referenced by any iterator `j` in the range `[stencil,stencil + (last - first))` for all iterators `i` in the range `[map,map + (last - first))`.
|
373 |
-
*
|
374 |
-
* \pre The expression `result[*i]` shall be valid for all iterators `i` in the range `[map,map + (last - first))` for which the following condition holds: `pred(*(stencil + i)) != false`.
|
375 |
-
*
|
376 |
-
* \code
|
377 |
-
* #include <thrust/scatter.h>
|
378 |
-
*
|
379 |
-
* struct is_even
|
380 |
-
* {
|
381 |
-
* __host__ __device__
|
382 |
-
* bool operator()(int x)
|
383 |
-
* {
|
384 |
-
* return (x % 2) == 0;
|
385 |
-
* }
|
386 |
-
* };
|
387 |
-
*
|
388 |
-
* ...
|
389 |
-
*
|
390 |
-
* int V[8] = {10, 20, 30, 40, 50, 60, 70, 80};
|
391 |
-
* int M[8] = {0, 5, 1, 6, 2, 7, 3, 4};
|
392 |
-
* int S[8] = {2, 1, 2, 1, 2, 1, 2, 1};
|
393 |
-
* int D[8] = {0, 0, 0, 0, 0, 0, 0, 0};
|
394 |
-
*
|
395 |
-
* is_even pred;
|
396 |
-
* thrust::scatter_if(V, V + 8, M, S, D, pred);
|
397 |
-
*
|
398 |
-
* // D contains [10, 30, 50, 70, 0, 0, 0, 0];
|
399 |
-
* \endcode
|
400 |
-
*
|
401 |
-
* \note \p scatter_if is the inverse of thrust::gather_if.
|
402 |
-
*/
|
403 |
-
template<typename InputIterator1,
|
404 |
-
typename InputIterator2,
|
405 |
-
typename InputIterator3,
|
406 |
-
typename RandomAccessIterator,
|
407 |
-
typename Predicate>
|
408 |
-
void scatter_if(InputIterator1 first,
|
409 |
-
InputIterator1 last,
|
410 |
-
InputIterator2 map,
|
411 |
-
InputIterator3 stencil,
|
412 |
-
RandomAccessIterator output,
|
413 |
-
Predicate pred);
|
414 |
-
|
415 |
-
|
416 |
-
/*! \} // end scattering
|
417 |
-
*/
|
418 |
-
|
419 |
-
|
420 |
-
} // end namespace thrust
|
421 |
-
|
422 |
-
#include <thrust/detail/scatter.inl>
|
423 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/CVPR/LIVE/thrust/thrust/system/detail/generic/advance.h
DELETED
@@ -1,41 +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 |
-
|
18 |
-
#pragma once
|
19 |
-
|
20 |
-
#include <thrust/detail/config.h>
|
21 |
-
|
22 |
-
namespace thrust
|
23 |
-
{
|
24 |
-
namespace system
|
25 |
-
{
|
26 |
-
namespace detail
|
27 |
-
{
|
28 |
-
namespace generic
|
29 |
-
{
|
30 |
-
|
31 |
-
template<typename InputIterator, typename Distance>
|
32 |
-
__host__ __device__
|
33 |
-
void advance(InputIterator& i, Distance n);
|
34 |
-
|
35 |
-
} // end namespace generic
|
36 |
-
} // end namespace detail
|
37 |
-
} // end namespace system
|
38 |
-
} // end namespace thrust
|
39 |
-
|
40 |
-
#include <thrust/system/detail/generic/advance.inl>
|
41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Cpp4App/Cpp4App/CDM/detect_text/text_detection.py
DELETED
@@ -1,289 +0,0 @@
|
|
1 |
-
import CDM.detect_text.ocr as ocr
|
2 |
-
from CDM.detect_text.Text import Text
|
3 |
-
import numpy as np
|
4 |
-
import cv2
|
5 |
-
import json
|
6 |
-
import time
|
7 |
-
import os
|
8 |
-
from os.path import join as pjoin
|
9 |
-
# from paddleocr import PaddleOCR
|
10 |
-
import pytesseract
|
11 |
-
|
12 |
-
# paddle_model = PaddleOCR(use_angle_cls=True, lang="en") #'ch' for chinese and english, 'en' for english
|
13 |
-
|
14 |
-
|
15 |
-
def save_detection_json(file_path, texts, img_shape):
|
16 |
-
f_out = open(file_path, 'w')
|
17 |
-
output = {'img_shape': img_shape, 'texts': []}
|
18 |
-
for text in texts:
|
19 |
-
c = {'id': text.id, 'content': text.content}
|
20 |
-
loc = text.location
|
21 |
-
c['column_min'], c['row_min'], c['column_max'], c['row_max'] = loc['left'], loc['top'], loc['right'], loc['bottom']
|
22 |
-
c['width'] = text.width
|
23 |
-
c['height'] = text.height
|
24 |
-
output['texts'].append(c)
|
25 |
-
json.dump(output, f_out, indent=4)
|
26 |
-
|
27 |
-
|
28 |
-
def visualize_texts(org_img, texts, shown_resize_height=None, show=False, write_path=None):
|
29 |
-
img = org_img.copy()
|
30 |
-
for text in texts:
|
31 |
-
text.visualize_element(img, line=2)
|
32 |
-
|
33 |
-
img_resize = img
|
34 |
-
if shown_resize_height is not None:
|
35 |
-
img_resize = cv2.resize(img, (int(shown_resize_height * (img.shape[1]/img.shape[0])), shown_resize_height))
|
36 |
-
|
37 |
-
if show:
|
38 |
-
cv2.imshow('texts', img_resize)
|
39 |
-
cv2.waitKey(0)
|
40 |
-
cv2.destroyWindow('texts')
|
41 |
-
if write_path is not None:
|
42 |
-
cv2.imwrite(write_path, img)
|
43 |
-
|
44 |
-
|
45 |
-
def text_sentences_recognition(texts):
|
46 |
-
'''
|
47 |
-
Merge separate words detected by Google ocr into a sentence
|
48 |
-
'''
|
49 |
-
changed = True
|
50 |
-
while changed:
|
51 |
-
changed = False
|
52 |
-
temp_set = []
|
53 |
-
for text_a in texts:
|
54 |
-
merged = False
|
55 |
-
for text_b in temp_set:
|
56 |
-
if text_a.is_on_same_line(text_b, 'h', bias_justify=0.2 * min(text_a.height, text_b.height), bias_gap=2 * max(text_a.word_width, text_b.word_width)):
|
57 |
-
text_b.merge_text(text_a)
|
58 |
-
merged = True
|
59 |
-
changed = True
|
60 |
-
break
|
61 |
-
if not merged:
|
62 |
-
temp_set.append(text_a)
|
63 |
-
texts = temp_set.copy()
|
64 |
-
|
65 |
-
for i, text in enumerate(texts):
|
66 |
-
text.id = i
|
67 |
-
return texts
|
68 |
-
|
69 |
-
|
70 |
-
def merge_intersected_texts(texts):
|
71 |
-
'''
|
72 |
-
Merge intersected texts (sentences or words)
|
73 |
-
'''
|
74 |
-
changed = True
|
75 |
-
while changed:
|
76 |
-
changed = False
|
77 |
-
temp_set = []
|
78 |
-
for text_a in texts:
|
79 |
-
merged = False
|
80 |
-
for text_b in temp_set:
|
81 |
-
if text_a.is_intersected(text_b, bias=2):
|
82 |
-
text_b.merge_text(text_a)
|
83 |
-
merged = True
|
84 |
-
changed = True
|
85 |
-
break
|
86 |
-
if not merged:
|
87 |
-
temp_set.append(text_a)
|
88 |
-
texts = temp_set.copy()
|
89 |
-
return texts
|
90 |
-
|
91 |
-
|
92 |
-
def text_cvt_orc_format(ocr_result):
|
93 |
-
texts = []
|
94 |
-
if ocr_result is not None:
|
95 |
-
for i, result in enumerate(ocr_result):
|
96 |
-
error = False
|
97 |
-
x_coordinates = []
|
98 |
-
y_coordinates = []
|
99 |
-
text_location = result['boundingPoly']['vertices']
|
100 |
-
content = result['description']
|
101 |
-
for loc in text_location:
|
102 |
-
if 'x' not in loc or 'y' not in loc:
|
103 |
-
error = True
|
104 |
-
break
|
105 |
-
x_coordinates.append(loc['x'])
|
106 |
-
y_coordinates.append(loc['y'])
|
107 |
-
if error: continue
|
108 |
-
location = {'left': min(x_coordinates), 'top': min(y_coordinates),
|
109 |
-
'right': max(x_coordinates), 'bottom': max(y_coordinates)}
|
110 |
-
texts.append(Text(i, content, location))
|
111 |
-
return texts
|
112 |
-
|
113 |
-
|
114 |
-
def text_cvt_orc_format_paddle(paddle_result):
|
115 |
-
texts = []
|
116 |
-
for i, line in enumerate(paddle_result):
|
117 |
-
points = np.array(line[0])
|
118 |
-
# points = points * 5
|
119 |
-
location = {'left': int(min(points[:, 0])), 'top': int(min(points[:, 1])), 'right': int(max(points[:, 0])),
|
120 |
-
'bottom': int(max(points[:, 1]))}
|
121 |
-
content = line[1][0]
|
122 |
-
texts.append(Text(i, content, location))
|
123 |
-
return texts
|
124 |
-
|
125 |
-
|
126 |
-
def text_cvt_orc_format_tesseract(tesseract_result):
|
127 |
-
# texts = []
|
128 |
-
# i_real = 0
|
129 |
-
# for i, line in enumerate(tesseract_result['text']):
|
130 |
-
# content = line.strip()
|
131 |
-
# location = {
|
132 |
-
# 'left': int(tesseract_result['left'][i]),
|
133 |
-
# 'top': int(tesseract_result['top'][i]),
|
134 |
-
# 'right': int(tesseract_result['left'][i]) + int(tesseract_result['width'][i]),
|
135 |
-
# 'bottom': int(tesseract_result['top'][i]) + int(tesseract_result['height'][i])
|
136 |
-
# }
|
137 |
-
# if len(content) > 0:
|
138 |
-
# texts.append(Text(i_real, content, location))
|
139 |
-
# i_real = i_real + 1
|
140 |
-
|
141 |
-
# Extract line boxes
|
142 |
-
texts = []
|
143 |
-
i_real = 0
|
144 |
-
line_boxes = []
|
145 |
-
n_boxes = len(tesseract_result['level'])
|
146 |
-
for i in range(n_boxes):
|
147 |
-
if tesseract_result['level'][i] == 4 and len(tesseract_result['text'][i].strip()) > 0:
|
148 |
-
# (x, y, w, h) = (tesseract_result['left'][i], tesseract_result['top'][i], tesseract_result['width'][i], tesseract_result['height'][i])
|
149 |
-
content = tesseract_result['text'][i].strip()
|
150 |
-
location = {
|
151 |
-
'left': int(tesseract_result['left'][i]),
|
152 |
-
'top': int(tesseract_result['top'][i]),
|
153 |
-
'right': int(tesseract_result['left'][i]) + int(tesseract_result['width'][i]),
|
154 |
-
'bottom': int(tesseract_result['top'][i]) + int(tesseract_result['height'][i])
|
155 |
-
}
|
156 |
-
texts.append(Text(i_real, content, location))
|
157 |
-
i_real = i_real + 1
|
158 |
-
# print("ocr result: ", texts)
|
159 |
-
|
160 |
-
return texts
|
161 |
-
|
162 |
-
def text_cvt_orc_format_tesseract_by_line(data):
|
163 |
-
|
164 |
-
# line_data = []
|
165 |
-
line_num = None
|
166 |
-
line_text = []
|
167 |
-
line_box = [0, 0, 0, 0]
|
168 |
-
texts = []
|
169 |
-
i_real = 0
|
170 |
-
|
171 |
-
for i in range(len(data['level'])):
|
172 |
-
# check if the level is word
|
173 |
-
if data['level'][i] == 5:
|
174 |
-
if line_num != data['line_num'][i]:
|
175 |
-
if line_num is not None: # append the previous line data to line_data
|
176 |
-
content = ' '.join(line_text)
|
177 |
-
location = {
|
178 |
-
'left': line_box[0],
|
179 |
-
'top': line_box[1],
|
180 |
-
'right': line_box[2],
|
181 |
-
'bottom': line_box[3]
|
182 |
-
}
|
183 |
-
texts.append(Text(i_real, content, location))
|
184 |
-
i_real = i_real + 1
|
185 |
-
|
186 |
-
# start a new line
|
187 |
-
line_num = data['line_num'][i]
|
188 |
-
line_text = [data['text'][i]]
|
189 |
-
line_box = [
|
190 |
-
data['left'][i],
|
191 |
-
data['top'][i],
|
192 |
-
data['left'][i] + data['width'][i],
|
193 |
-
data['top'][i] + data['height'][i],
|
194 |
-
]
|
195 |
-
else: # add a word to the current line
|
196 |
-
line_text.append(data['text'][i])
|
197 |
-
line_box[2] = max(line_box[2], data['left'][i] + data['width'][i])
|
198 |
-
line_box[3] = max(line_box[3], data['top'][i] + data['height'][i])
|
199 |
-
|
200 |
-
# append the last line data to line_data
|
201 |
-
if line_text:
|
202 |
-
content = ' '.join(line_text)
|
203 |
-
location = {
|
204 |
-
'left': line_box[0],
|
205 |
-
'top': line_box[1],
|
206 |
-
'right': line_box[2],
|
207 |
-
'bottom': line_box[3]
|
208 |
-
}
|
209 |
-
texts.append(Text(i_real, content, location))
|
210 |
-
i_real = i_real + 1
|
211 |
-
|
212 |
-
return texts
|
213 |
-
|
214 |
-
|
215 |
-
def text_filter_noise(texts):
|
216 |
-
valid_texts = []
|
217 |
-
for text in texts:
|
218 |
-
if len(text.content) <= 1 and text.content.lower() not in ['a', ',', '.', '!', '?', '$', '%', ':', '&', '+']:
|
219 |
-
continue
|
220 |
-
valid_texts.append(text)
|
221 |
-
return valid_texts
|
222 |
-
|
223 |
-
|
224 |
-
def text_detection(input_file='../data/input/30800.jpg', output_file='../data/output', show=False, method='google', paddle_model=None):
|
225 |
-
'''
|
226 |
-
:param method: google or paddle
|
227 |
-
:param paddle_model: the preload paddle model for paddle ocr
|
228 |
-
'''
|
229 |
-
start = time.process_time()
|
230 |
-
name = input_file.split('/')[-1][:-4]
|
231 |
-
ocr_root = pjoin(output_file, 'ocr')
|
232 |
-
img = cv2.imread(input_file)
|
233 |
-
if img is None:
|
234 |
-
print("imread nothing!")
|
235 |
-
|
236 |
-
# resize the img to speed up the ocr
|
237 |
-
# img = cv2.resize(img, (int(img.shape[1]/5), int(img.shape[0]/5)))
|
238 |
-
# cv2.imshow("img", img)
|
239 |
-
# cv2.waitKey(0)
|
240 |
-
|
241 |
-
if method == 'google':
|
242 |
-
print('*** Detect Text through Google OCR ***')
|
243 |
-
ocr_result = ocr.ocr_detection_google(input_file)
|
244 |
-
texts = text_cvt_orc_format(ocr_result)
|
245 |
-
texts = merge_intersected_texts(texts)
|
246 |
-
texts = text_filter_noise(texts)
|
247 |
-
texts = text_sentences_recognition(texts)
|
248 |
-
ocr_time_cost = time.process_time() - start
|
249 |
-
elif method == 'paddle':
|
250 |
-
# The import of the paddle ocr can be separate to the beginning of the program if you decide to use this method
|
251 |
-
# from paddleocr import PaddleOCR
|
252 |
-
print('*** Detect Text through Paddle OCR ***')
|
253 |
-
# if paddle_model is None:
|
254 |
-
# paddle_model = PaddleOCR(use_angle_cls=True, lang="en") #'ch' for chinese and english, 'en' for english
|
255 |
-
# None
|
256 |
-
result = paddle_model.ocr(input_file, cls=True)
|
257 |
-
ocr_time_cost = time.process_time() - start
|
258 |
-
texts = text_cvt_orc_format_paddle(result)
|
259 |
-
|
260 |
-
elif method == 'pytesseract':
|
261 |
-
|
262 |
-
img_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
|
263 |
-
|
264 |
-
# Perform OCR using Tesseract
|
265 |
-
result = pytesseract.image_to_data(img_rgb, output_type=pytesseract.Output.DICT)
|
266 |
-
print("ocr result: ", result)
|
267 |
-
|
268 |
-
ocr_time_cost = time.process_time() - start
|
269 |
-
|
270 |
-
# Convert the Tesseract result to the desired format
|
271 |
-
texts = text_cvt_orc_format_tesseract_by_line(result)
|
272 |
-
print("texts: ", texts)
|
273 |
-
else:
|
274 |
-
raise ValueError('Method has to be "google" or "paddle" or "pytesseract"')
|
275 |
-
|
276 |
-
visualize_texts(img, texts, shown_resize_height=800, show=show, write_path=pjoin(ocr_root, name+'.png'))
|
277 |
-
save_detection_json(pjoin(ocr_root, name+'.json'), texts, img.shape)
|
278 |
-
# ocr_time_cost = time.process_time() - start
|
279 |
-
print("[Text Detection Completed in %.3f s] Input: %s Output: %s" % (ocr_time_cost, input_file, pjoin(ocr_root, name+'.json')))
|
280 |
-
|
281 |
-
# print("!!! detected content !!!")
|
282 |
-
# for text in texts:
|
283 |
-
# print(text.content)
|
284 |
-
|
285 |
-
return ocr_time_cost
|
286 |
-
|
287 |
-
|
288 |
-
# text_detection()
|
289 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/DHEIVER/Segmento_de_Angio_Coronariana_v5/preprocess.py
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
import cv2
|
2 |
-
import numpy as np
|
3 |
-
|
4 |
-
def unsharp_masking(img, kernel_size=5, threshold=2.0):
|
5 |
-
if kernel_size % 2 == 0:
|
6 |
-
kernel_size += 1 # Ensure the kernel size is odd
|
7 |
-
gaussian = cv2.GaussianBlur(img, (kernel_size, kernel_size), 2.0)
|
8 |
-
unsharp_mask = cv2.addWeighted(img, threshold, gaussian, -1.0, 0)
|
9 |
-
# Clip the pixel values to the valid range [0, 255]
|
10 |
-
unsharp_mask = np.clip(unsharp_mask, 0, 255)
|
11 |
-
# Normalize the image to bring pixel values back to [0, 255]
|
12 |
-
cv2.normalize(unsharp_mask, unsharp_mask, 0, 255, cv2.NORM_MINMAX)
|
13 |
-
return unsharp_mask
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/fontTools/varLib/stat.py
DELETED
@@ -1,142 +0,0 @@
|
|
1 |
-
"""Extra methods for DesignSpaceDocument to generate its STAT table data."""
|
2 |
-
|
3 |
-
from __future__ import annotations
|
4 |
-
|
5 |
-
from typing import Dict, List, Union
|
6 |
-
|
7 |
-
import fontTools.otlLib.builder
|
8 |
-
from fontTools.designspaceLib import (
|
9 |
-
AxisLabelDescriptor,
|
10 |
-
DesignSpaceDocument,
|
11 |
-
DesignSpaceDocumentError,
|
12 |
-
LocationLabelDescriptor,
|
13 |
-
)
|
14 |
-
from fontTools.designspaceLib.types import Region, getVFUserRegion, locationInRegion
|
15 |
-
from fontTools.ttLib import TTFont
|
16 |
-
|
17 |
-
|
18 |
-
def buildVFStatTable(ttFont: TTFont, doc: DesignSpaceDocument, vfName: str) -> None:
|
19 |
-
"""Build the STAT table for the variable font identified by its name in
|
20 |
-
the given document.
|
21 |
-
|
22 |
-
Knowing which variable we're building STAT data for is needed to subset
|
23 |
-
the STAT locations to only include what the variable font actually ships.
|
24 |
-
|
25 |
-
.. versionadded:: 5.0
|
26 |
-
|
27 |
-
.. seealso::
|
28 |
-
- :func:`getStatAxes()`
|
29 |
-
- :func:`getStatLocations()`
|
30 |
-
- :func:`fontTools.otlLib.builder.buildStatTable()`
|
31 |
-
"""
|
32 |
-
for vf in doc.getVariableFonts():
|
33 |
-
if vf.name == vfName:
|
34 |
-
break
|
35 |
-
else:
|
36 |
-
raise DesignSpaceDocumentError(
|
37 |
-
f"Cannot find the variable font by name {vfName}"
|
38 |
-
)
|
39 |
-
|
40 |
-
region = getVFUserRegion(doc, vf)
|
41 |
-
|
42 |
-
return fontTools.otlLib.builder.buildStatTable(
|
43 |
-
ttFont,
|
44 |
-
getStatAxes(doc, region),
|
45 |
-
getStatLocations(doc, region),
|
46 |
-
doc.elidedFallbackName if doc.elidedFallbackName is not None else 2,
|
47 |
-
)
|
48 |
-
|
49 |
-
|
50 |
-
def getStatAxes(doc: DesignSpaceDocument, userRegion: Region) -> List[Dict]:
|
51 |
-
"""Return a list of axis dicts suitable for use as the ``axes``
|
52 |
-
argument to :func:`fontTools.otlLib.builder.buildStatTable()`.
|
53 |
-
|
54 |
-
.. versionadded:: 5.0
|
55 |
-
"""
|
56 |
-
# First, get the axis labels with explicit ordering
|
57 |
-
# then append the others in the order they appear.
|
58 |
-
maxOrdering = max(
|
59 |
-
(axis.axisOrdering for axis in doc.axes if axis.axisOrdering is not None),
|
60 |
-
default=-1,
|
61 |
-
)
|
62 |
-
axisOrderings = []
|
63 |
-
for axis in doc.axes:
|
64 |
-
if axis.axisOrdering is not None:
|
65 |
-
axisOrderings.append(axis.axisOrdering)
|
66 |
-
else:
|
67 |
-
maxOrdering += 1
|
68 |
-
axisOrderings.append(maxOrdering)
|
69 |
-
return [
|
70 |
-
dict(
|
71 |
-
tag=axis.tag,
|
72 |
-
name={"en": axis.name, **axis.labelNames},
|
73 |
-
ordering=ordering,
|
74 |
-
values=[
|
75 |
-
_axisLabelToStatLocation(label)
|
76 |
-
for label in axis.axisLabels
|
77 |
-
if locationInRegion({axis.name: label.userValue}, userRegion)
|
78 |
-
],
|
79 |
-
)
|
80 |
-
for axis, ordering in zip(doc.axes, axisOrderings)
|
81 |
-
]
|
82 |
-
|
83 |
-
|
84 |
-
def getStatLocations(doc: DesignSpaceDocument, userRegion: Region) -> List[Dict]:
|
85 |
-
"""Return a list of location dicts suitable for use as the ``locations``
|
86 |
-
argument to :func:`fontTools.otlLib.builder.buildStatTable()`.
|
87 |
-
|
88 |
-
.. versionadded:: 5.0
|
89 |
-
"""
|
90 |
-
axesByName = {axis.name: axis for axis in doc.axes}
|
91 |
-
return [
|
92 |
-
dict(
|
93 |
-
name={"en": label.name, **label.labelNames},
|
94 |
-
# Location in the designspace is keyed by axis name
|
95 |
-
# Location in buildStatTable by axis tag
|
96 |
-
location={
|
97 |
-
axesByName[name].tag: value
|
98 |
-
for name, value in label.getFullUserLocation(doc).items()
|
99 |
-
},
|
100 |
-
flags=_labelToFlags(label),
|
101 |
-
)
|
102 |
-
for label in doc.locationLabels
|
103 |
-
if locationInRegion(label.getFullUserLocation(doc), userRegion)
|
104 |
-
]
|
105 |
-
|
106 |
-
|
107 |
-
def _labelToFlags(label: Union[AxisLabelDescriptor, LocationLabelDescriptor]) -> int:
|
108 |
-
flags = 0
|
109 |
-
if label.olderSibling:
|
110 |
-
flags |= 1
|
111 |
-
if label.elidable:
|
112 |
-
flags |= 2
|
113 |
-
return flags
|
114 |
-
|
115 |
-
|
116 |
-
def _axisLabelToStatLocation(
|
117 |
-
label: AxisLabelDescriptor,
|
118 |
-
) -> Dict:
|
119 |
-
label_format = label.getFormat()
|
120 |
-
name = {"en": label.name, **label.labelNames}
|
121 |
-
flags = _labelToFlags(label)
|
122 |
-
if label_format == 1:
|
123 |
-
return dict(name=name, value=label.userValue, flags=flags)
|
124 |
-
if label_format == 3:
|
125 |
-
return dict(
|
126 |
-
name=name,
|
127 |
-
value=label.userValue,
|
128 |
-
linkedValue=label.linkedUserValue,
|
129 |
-
flags=flags,
|
130 |
-
)
|
131 |
-
if label_format == 2:
|
132 |
-
res = dict(
|
133 |
-
name=name,
|
134 |
-
nominalValue=label.userValue,
|
135 |
-
flags=flags,
|
136 |
-
)
|
137 |
-
if label.userMinimum is not None:
|
138 |
-
res["rangeMinValue"] = label.userMinimum
|
139 |
-
if label.userMaximum is not None:
|
140 |
-
res["rangeMaxValue"] = label.userMaximum
|
141 |
-
return res
|
142 |
-
raise NotImplementedError("Unknown STAT label format")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/httpcore/_async/connection_pool.py
DELETED
@@ -1,356 +0,0 @@
|
|
1 |
-
import ssl
|
2 |
-
import sys
|
3 |
-
from types import TracebackType
|
4 |
-
from typing import AsyncIterable, AsyncIterator, Iterable, List, Optional, Type
|
5 |
-
|
6 |
-
from .._backends.auto import AutoBackend
|
7 |
-
from .._backends.base import SOCKET_OPTION, AsyncNetworkBackend
|
8 |
-
from .._exceptions import ConnectionNotAvailable, UnsupportedProtocol
|
9 |
-
from .._models import Origin, Request, Response
|
10 |
-
from .._synchronization import AsyncEvent, AsyncLock, AsyncShieldCancellation
|
11 |
-
from .connection import AsyncHTTPConnection
|
12 |
-
from .interfaces import AsyncConnectionInterface, AsyncRequestInterface
|
13 |
-
|
14 |
-
|
15 |
-
class RequestStatus:
|
16 |
-
def __init__(self, request: Request):
|
17 |
-
self.request = request
|
18 |
-
self.connection: Optional[AsyncConnectionInterface] = None
|
19 |
-
self._connection_acquired = AsyncEvent()
|
20 |
-
|
21 |
-
def set_connection(self, connection: AsyncConnectionInterface) -> None:
|
22 |
-
assert self.connection is None
|
23 |
-
self.connection = connection
|
24 |
-
self._connection_acquired.set()
|
25 |
-
|
26 |
-
def unset_connection(self) -> None:
|
27 |
-
assert self.connection is not None
|
28 |
-
self.connection = None
|
29 |
-
self._connection_acquired = AsyncEvent()
|
30 |
-
|
31 |
-
async def wait_for_connection(
|
32 |
-
self, timeout: Optional[float] = None
|
33 |
-
) -> AsyncConnectionInterface:
|
34 |
-
if self.connection is None:
|
35 |
-
await self._connection_acquired.wait(timeout=timeout)
|
36 |
-
assert self.connection is not None
|
37 |
-
return self.connection
|
38 |
-
|
39 |
-
|
40 |
-
class AsyncConnectionPool(AsyncRequestInterface):
|
41 |
-
"""
|
42 |
-
A connection pool for making HTTP requests.
|
43 |
-
"""
|
44 |
-
|
45 |
-
def __init__(
|
46 |
-
self,
|
47 |
-
ssl_context: Optional[ssl.SSLContext] = None,
|
48 |
-
max_connections: Optional[int] = 10,
|
49 |
-
max_keepalive_connections: Optional[int] = None,
|
50 |
-
keepalive_expiry: Optional[float] = None,
|
51 |
-
http1: bool = True,
|
52 |
-
http2: bool = False,
|
53 |
-
retries: int = 0,
|
54 |
-
local_address: Optional[str] = None,
|
55 |
-
uds: Optional[str] = None,
|
56 |
-
network_backend: Optional[AsyncNetworkBackend] = None,
|
57 |
-
socket_options: Optional[Iterable[SOCKET_OPTION]] = None,
|
58 |
-
) -> None:
|
59 |
-
"""
|
60 |
-
A connection pool for making HTTP requests.
|
61 |
-
|
62 |
-
Parameters:
|
63 |
-
ssl_context: An SSL context to use for verifying connections.
|
64 |
-
If not specified, the default `httpcore.default_ssl_context()`
|
65 |
-
will be used.
|
66 |
-
max_connections: The maximum number of concurrent HTTP connections that
|
67 |
-
the pool should allow. Any attempt to send a request on a pool that
|
68 |
-
would exceed this amount will block until a connection is available.
|
69 |
-
max_keepalive_connections: The maximum number of idle HTTP connections
|
70 |
-
that will be maintained in the pool.
|
71 |
-
keepalive_expiry: The duration in seconds that an idle HTTP connection
|
72 |
-
may be maintained for before being expired from the pool.
|
73 |
-
http1: A boolean indicating if HTTP/1.1 requests should be supported
|
74 |
-
by the connection pool. Defaults to True.
|
75 |
-
http2: A boolean indicating if HTTP/2 requests should be supported by
|
76 |
-
the connection pool. Defaults to False.
|
77 |
-
retries: The maximum number of retries when trying to establish a
|
78 |
-
connection.
|
79 |
-
local_address: Local address to connect from. Can also be used to connect
|
80 |
-
using a particular address family. Using `local_address="0.0.0.0"`
|
81 |
-
will connect using an `AF_INET` address (IPv4), while using
|
82 |
-
`local_address="::"` will connect using an `AF_INET6` address (IPv6).
|
83 |
-
uds: Path to a Unix Domain Socket to use instead of TCP sockets.
|
84 |
-
network_backend: A backend instance to use for handling network I/O.
|
85 |
-
socket_options: Socket options that have to be included
|
86 |
-
in the TCP socket when the connection was established.
|
87 |
-
"""
|
88 |
-
self._ssl_context = ssl_context
|
89 |
-
|
90 |
-
self._max_connections = (
|
91 |
-
sys.maxsize if max_connections is None else max_connections
|
92 |
-
)
|
93 |
-
self._max_keepalive_connections = (
|
94 |
-
sys.maxsize
|
95 |
-
if max_keepalive_connections is None
|
96 |
-
else max_keepalive_connections
|
97 |
-
)
|
98 |
-
self._max_keepalive_connections = min(
|
99 |
-
self._max_connections, self._max_keepalive_connections
|
100 |
-
)
|
101 |
-
|
102 |
-
self._keepalive_expiry = keepalive_expiry
|
103 |
-
self._http1 = http1
|
104 |
-
self._http2 = http2
|
105 |
-
self._retries = retries
|
106 |
-
self._local_address = local_address
|
107 |
-
self._uds = uds
|
108 |
-
|
109 |
-
self._pool: List[AsyncConnectionInterface] = []
|
110 |
-
self._requests: List[RequestStatus] = []
|
111 |
-
self._pool_lock = AsyncLock()
|
112 |
-
self._network_backend = (
|
113 |
-
AutoBackend() if network_backend is None else network_backend
|
114 |
-
)
|
115 |
-
self._socket_options = socket_options
|
116 |
-
|
117 |
-
def create_connection(self, origin: Origin) -> AsyncConnectionInterface:
|
118 |
-
return AsyncHTTPConnection(
|
119 |
-
origin=origin,
|
120 |
-
ssl_context=self._ssl_context,
|
121 |
-
keepalive_expiry=self._keepalive_expiry,
|
122 |
-
http1=self._http1,
|
123 |
-
http2=self._http2,
|
124 |
-
retries=self._retries,
|
125 |
-
local_address=self._local_address,
|
126 |
-
uds=self._uds,
|
127 |
-
network_backend=self._network_backend,
|
128 |
-
socket_options=self._socket_options,
|
129 |
-
)
|
130 |
-
|
131 |
-
@property
|
132 |
-
def connections(self) -> List[AsyncConnectionInterface]:
|
133 |
-
"""
|
134 |
-
Return a list of the connections currently in the pool.
|
135 |
-
|
136 |
-
For example:
|
137 |
-
|
138 |
-
```python
|
139 |
-
>>> pool.connections
|
140 |
-
[
|
141 |
-
<AsyncHTTPConnection ['https://example.com:443', HTTP/1.1, ACTIVE, Request Count: 6]>,
|
142 |
-
<AsyncHTTPConnection ['https://example.com:443', HTTP/1.1, IDLE, Request Count: 9]> ,
|
143 |
-
<AsyncHTTPConnection ['http://example.com:80', HTTP/1.1, IDLE, Request Count: 1]>,
|
144 |
-
]
|
145 |
-
```
|
146 |
-
"""
|
147 |
-
return list(self._pool)
|
148 |
-
|
149 |
-
async def _attempt_to_acquire_connection(self, status: RequestStatus) -> bool:
|
150 |
-
"""
|
151 |
-
Attempt to provide a connection that can handle the given origin.
|
152 |
-
"""
|
153 |
-
origin = status.request.url.origin
|
154 |
-
|
155 |
-
# If there are queued requests in front of us, then don't acquire a
|
156 |
-
# connection. We handle requests strictly in order.
|
157 |
-
waiting = [s for s in self._requests if s.connection is None]
|
158 |
-
if waiting and waiting[0] is not status:
|
159 |
-
return False
|
160 |
-
|
161 |
-
# Reuse an existing connection if one is currently available.
|
162 |
-
for idx, connection in enumerate(self._pool):
|
163 |
-
if connection.can_handle_request(origin) and connection.is_available():
|
164 |
-
self._pool.pop(idx)
|
165 |
-
self._pool.insert(0, connection)
|
166 |
-
status.set_connection(connection)
|
167 |
-
return True
|
168 |
-
|
169 |
-
# If the pool is currently full, attempt to close one idle connection.
|
170 |
-
if len(self._pool) >= self._max_connections:
|
171 |
-
for idx, connection in reversed(list(enumerate(self._pool))):
|
172 |
-
if connection.is_idle():
|
173 |
-
await connection.aclose()
|
174 |
-
self._pool.pop(idx)
|
175 |
-
break
|
176 |
-
|
177 |
-
# If the pool is still full, then we cannot acquire a connection.
|
178 |
-
if len(self._pool) >= self._max_connections:
|
179 |
-
return False
|
180 |
-
|
181 |
-
# Otherwise create a new connection.
|
182 |
-
connection = self.create_connection(origin)
|
183 |
-
self._pool.insert(0, connection)
|
184 |
-
status.set_connection(connection)
|
185 |
-
return True
|
186 |
-
|
187 |
-
async def _close_expired_connections(self) -> None:
|
188 |
-
"""
|
189 |
-
Clean up the connection pool by closing off any connections that have expired.
|
190 |
-
"""
|
191 |
-
# Close any connections that have expired their keep-alive time.
|
192 |
-
for idx, connection in reversed(list(enumerate(self._pool))):
|
193 |
-
if connection.has_expired():
|
194 |
-
await connection.aclose()
|
195 |
-
self._pool.pop(idx)
|
196 |
-
|
197 |
-
# If the pool size exceeds the maximum number of allowed keep-alive connections,
|
198 |
-
# then close off idle connections as required.
|
199 |
-
pool_size = len(self._pool)
|
200 |
-
for idx, connection in reversed(list(enumerate(self._pool))):
|
201 |
-
if connection.is_idle() and pool_size > self._max_keepalive_connections:
|
202 |
-
await connection.aclose()
|
203 |
-
self._pool.pop(idx)
|
204 |
-
pool_size -= 1
|
205 |
-
|
206 |
-
async def handle_async_request(self, request: Request) -> Response:
|
207 |
-
"""
|
208 |
-
Send an HTTP request, and return an HTTP response.
|
209 |
-
|
210 |
-
This is the core implementation that is called into by `.request()` or `.stream()`.
|
211 |
-
"""
|
212 |
-
scheme = request.url.scheme.decode()
|
213 |
-
if scheme == "":
|
214 |
-
raise UnsupportedProtocol(
|
215 |
-
"Request URL is missing an 'http://' or 'https://' protocol."
|
216 |
-
)
|
217 |
-
if scheme not in ("http", "https", "ws", "wss"):
|
218 |
-
raise UnsupportedProtocol(
|
219 |
-
f"Request URL has an unsupported protocol '{scheme}://'."
|
220 |
-
)
|
221 |
-
|
222 |
-
status = RequestStatus(request)
|
223 |
-
|
224 |
-
async with self._pool_lock:
|
225 |
-
self._requests.append(status)
|
226 |
-
await self._close_expired_connections()
|
227 |
-
await self._attempt_to_acquire_connection(status)
|
228 |
-
|
229 |
-
while True:
|
230 |
-
timeouts = request.extensions.get("timeout", {})
|
231 |
-
timeout = timeouts.get("pool", None)
|
232 |
-
try:
|
233 |
-
connection = await status.wait_for_connection(timeout=timeout)
|
234 |
-
except BaseException as exc:
|
235 |
-
# If we timeout here, or if the task is cancelled, then make
|
236 |
-
# sure to remove the request from the queue before bubbling
|
237 |
-
# up the exception.
|
238 |
-
async with self._pool_lock:
|
239 |
-
# Ensure only remove when task exists.
|
240 |
-
if status in self._requests:
|
241 |
-
self._requests.remove(status)
|
242 |
-
raise exc
|
243 |
-
|
244 |
-
try:
|
245 |
-
response = await connection.handle_async_request(request)
|
246 |
-
except ConnectionNotAvailable:
|
247 |
-
# The ConnectionNotAvailable exception is a special case, that
|
248 |
-
# indicates we need to retry the request on a new connection.
|
249 |
-
#
|
250 |
-
# The most common case where this can occur is when multiple
|
251 |
-
# requests are queued waiting for a single connection, which
|
252 |
-
# might end up as an HTTP/2 connection, but which actually ends
|
253 |
-
# up as HTTP/1.1.
|
254 |
-
async with self._pool_lock:
|
255 |
-
# Maintain our position in the request queue, but reset the
|
256 |
-
# status so that the request becomes queued again.
|
257 |
-
status.unset_connection()
|
258 |
-
await self._attempt_to_acquire_connection(status)
|
259 |
-
except BaseException as exc:
|
260 |
-
with AsyncShieldCancellation():
|
261 |
-
await self.response_closed(status)
|
262 |
-
raise exc
|
263 |
-
else:
|
264 |
-
break
|
265 |
-
|
266 |
-
# When we return the response, we wrap the stream in a special class
|
267 |
-
# that handles notifying the connection pool once the response
|
268 |
-
# has been released.
|
269 |
-
assert isinstance(response.stream, AsyncIterable)
|
270 |
-
return Response(
|
271 |
-
status=response.status,
|
272 |
-
headers=response.headers,
|
273 |
-
content=ConnectionPoolByteStream(response.stream, self, status),
|
274 |
-
extensions=response.extensions,
|
275 |
-
)
|
276 |
-
|
277 |
-
async def response_closed(self, status: RequestStatus) -> None:
|
278 |
-
"""
|
279 |
-
This method acts as a callback once the request/response cycle is complete.
|
280 |
-
|
281 |
-
It is called into from the `ConnectionPoolByteStream.aclose()` method.
|
282 |
-
"""
|
283 |
-
assert status.connection is not None
|
284 |
-
connection = status.connection
|
285 |
-
|
286 |
-
async with self._pool_lock:
|
287 |
-
# Update the state of the connection pool.
|
288 |
-
if status in self._requests:
|
289 |
-
self._requests.remove(status)
|
290 |
-
|
291 |
-
if connection.is_closed() and connection in self._pool:
|
292 |
-
self._pool.remove(connection)
|
293 |
-
|
294 |
-
# Since we've had a response closed, it's possible we'll now be able
|
295 |
-
# to service one or more requests that are currently pending.
|
296 |
-
for status in self._requests:
|
297 |
-
if status.connection is None:
|
298 |
-
acquired = await self._attempt_to_acquire_connection(status)
|
299 |
-
# If we could not acquire a connection for a queued request
|
300 |
-
# then we don't need to check anymore requests that are
|
301 |
-
# queued later behind it.
|
302 |
-
if not acquired:
|
303 |
-
break
|
304 |
-
|
305 |
-
# Housekeeping.
|
306 |
-
await self._close_expired_connections()
|
307 |
-
|
308 |
-
async def aclose(self) -> None:
|
309 |
-
"""
|
310 |
-
Close any connections in the pool.
|
311 |
-
"""
|
312 |
-
async with self._pool_lock:
|
313 |
-
for connection in self._pool:
|
314 |
-
await connection.aclose()
|
315 |
-
self._pool = []
|
316 |
-
self._requests = []
|
317 |
-
|
318 |
-
async def __aenter__(self) -> "AsyncConnectionPool":
|
319 |
-
return self
|
320 |
-
|
321 |
-
async def __aexit__(
|
322 |
-
self,
|
323 |
-
exc_type: Optional[Type[BaseException]] = None,
|
324 |
-
exc_value: Optional[BaseException] = None,
|
325 |
-
traceback: Optional[TracebackType] = None,
|
326 |
-
) -> None:
|
327 |
-
await self.aclose()
|
328 |
-
|
329 |
-
|
330 |
-
class ConnectionPoolByteStream:
|
331 |
-
"""
|
332 |
-
A wrapper around the response byte stream, that additionally handles
|
333 |
-
notifying the connection pool when the response has been closed.
|
334 |
-
"""
|
335 |
-
|
336 |
-
def __init__(
|
337 |
-
self,
|
338 |
-
stream: AsyncIterable[bytes],
|
339 |
-
pool: AsyncConnectionPool,
|
340 |
-
status: RequestStatus,
|
341 |
-
) -> None:
|
342 |
-
self._stream = stream
|
343 |
-
self._pool = pool
|
344 |
-
self._status = status
|
345 |
-
|
346 |
-
async def __aiter__(self) -> AsyncIterator[bytes]:
|
347 |
-
async for part in self._stream:
|
348 |
-
yield part
|
349 |
-
|
350 |
-
async def aclose(self) -> None:
|
351 |
-
try:
|
352 |
-
if hasattr(self._stream, "aclose"):
|
353 |
-
await self._stream.aclose()
|
354 |
-
finally:
|
355 |
-
with AsyncShieldCancellation():
|
356 |
-
await self._pool.response_closed(self._status)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/DaFujaTyping/hf-Chat-ui/PRIVACY.md
DELETED
@@ -1,35 +0,0 @@
|
|
1 |
-
## Privacy
|
2 |
-
|
3 |
-
> Last updated: May 2nd, 2023
|
4 |
-
|
5 |
-
In this `v0.1` of HuggingChat, users are not authenticated in any way, i.e. this app doesn't have access to your HF user account even if you're logged in to huggingface.co. The app is only using an anonymous session cookie. ❗️ Warning ❗️ this means if you switch browsers or clear cookies, you will currently lose your conversations.
|
6 |
-
|
7 |
-
By default, your conversations are shared with the model's authors (for the `v0.1` model, to <a target="_blank" href="https://open-assistant.io/dashboard">Open Assistant</a>) to improve their training data and model over time. Model authors are the custodians of the data collected by their model, even if it's hosted on our platform.
|
8 |
-
|
9 |
-
If you disable data sharing in your settings, your conversations will not be used for any downstream usage (including for research or model training purposes), and they will only be stored to let you access past conversations. You can click on the Delete icon to delete any past conversation at any moment.
|
10 |
-
|
11 |
-
🗓 Please also consult huggingface.co's main privacy policy at https://huggingface.co/privacy. To exercise any of your legal privacy rights, please send an email to [email protected].
|
12 |
-
|
13 |
-
## About available LLMs
|
14 |
-
|
15 |
-
The goal of this app is to showcase that it is now (April 2023) possible to build an open source alternative to ChatGPT. 💪
|
16 |
-
|
17 |
-
For now, it's running OpenAssistant's [latest LLaMA based model](https://huggingface.co/OpenAssistant/oasst-sft-6-llama-30b-xor) (which is one of the current best open source chat models), but the plan in the longer-term is to expose all good-quality chat models from the Hub.
|
18 |
-
|
19 |
-
We are not affiliated with Open Assistant, but if you want to contribute to the training data for the next generation of open models, please consider contributing to https://open-assistant.io/ ❤️
|
20 |
-
|
21 |
-
## Technical details
|
22 |
-
|
23 |
-
This app is running in a [Space](https://huggingface.co/docs/hub/spaces-overview), which entails that the code for this UI is open source: https://huggingface.co/spaces/huggingchat/chat-ui/tree/main.
|
24 |
-
The inference backend is running [text-generation-inference](https://github.com/huggingface/text-generation-inference) on HuggingFace's Inference API infrastructure.
|
25 |
-
|
26 |
-
It is therefore possible to deploy a copy of this app to a Space and customize it (swap model, add some UI elements, or store user messages according to your own Terms and conditions)
|
27 |
-
|
28 |
-
We welcome any feedback on this app: please participate to the public discussion at https://huggingface.co/spaces/huggingchat/chat-ui/discussions
|
29 |
-
|
30 |
-
<a target="_blank" href="https://huggingface.co/spaces/huggingchat/chat-ui/discussions"><img src="https://huggingface.co/datasets/huggingface/badges/raw/main/open-a-discussion-xl.svg" title="open a discussion"></a>
|
31 |
-
|
32 |
-
## Coming soon
|
33 |
-
|
34 |
-
- LLM watermarking
|
35 |
-
- User setting to share conversations with model authors (done ✅)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/Dantra1/CeliaSensei/mel_processing.py
DELETED
@@ -1,101 +0,0 @@
|
|
1 |
-
import torch
|
2 |
-
import torch.utils.data
|
3 |
-
from librosa.filters import mel as librosa_mel_fn
|
4 |
-
|
5 |
-
MAX_WAV_VALUE = 32768.0
|
6 |
-
|
7 |
-
|
8 |
-
def dynamic_range_compression_torch(x, C=1, clip_val=1e-5):
|
9 |
-
"""
|
10 |
-
PARAMS
|
11 |
-
------
|
12 |
-
C: compression factor
|
13 |
-
"""
|
14 |
-
return torch.log(torch.clamp(x, min=clip_val) * C)
|
15 |
-
|
16 |
-
|
17 |
-
def dynamic_range_decompression_torch(x, C=1):
|
18 |
-
"""
|
19 |
-
PARAMS
|
20 |
-
------
|
21 |
-
C: compression factor used to compress
|
22 |
-
"""
|
23 |
-
return torch.exp(x) / C
|
24 |
-
|
25 |
-
|
26 |
-
def spectral_normalize_torch(magnitudes):
|
27 |
-
output = dynamic_range_compression_torch(magnitudes)
|
28 |
-
return output
|
29 |
-
|
30 |
-
|
31 |
-
def spectral_de_normalize_torch(magnitudes):
|
32 |
-
output = dynamic_range_decompression_torch(magnitudes)
|
33 |
-
return output
|
34 |
-
|
35 |
-
|
36 |
-
mel_basis = {}
|
37 |
-
hann_window = {}
|
38 |
-
|
39 |
-
|
40 |
-
def spectrogram_torch(y, n_fft, sampling_rate, hop_size, win_size, center=False):
|
41 |
-
if torch.min(y) < -1.:
|
42 |
-
print('min value is ', torch.min(y))
|
43 |
-
if torch.max(y) > 1.:
|
44 |
-
print('max value is ', torch.max(y))
|
45 |
-
|
46 |
-
global hann_window
|
47 |
-
dtype_device = str(y.dtype) + '_' + str(y.device)
|
48 |
-
wnsize_dtype_device = str(win_size) + '_' + dtype_device
|
49 |
-
if wnsize_dtype_device not in hann_window:
|
50 |
-
hann_window[wnsize_dtype_device] = torch.hann_window(win_size).to(dtype=y.dtype, device=y.device)
|
51 |
-
|
52 |
-
y = torch.nn.functional.pad(y.unsqueeze(1), (int((n_fft-hop_size)/2), int((n_fft-hop_size)/2)), mode='reflect')
|
53 |
-
y = y.squeeze(1)
|
54 |
-
|
55 |
-
spec = torch.stft(y, n_fft, hop_length=hop_size, win_length=win_size, window=hann_window[wnsize_dtype_device],
|
56 |
-
center=center, pad_mode='reflect', normalized=False, onesided=True, return_complex=False)
|
57 |
-
|
58 |
-
spec = torch.sqrt(spec.pow(2).sum(-1) + 1e-6)
|
59 |
-
return spec
|
60 |
-
|
61 |
-
|
62 |
-
def spec_to_mel_torch(spec, n_fft, num_mels, sampling_rate, fmin, fmax):
|
63 |
-
global mel_basis
|
64 |
-
dtype_device = str(spec.dtype) + '_' + str(spec.device)
|
65 |
-
fmax_dtype_device = str(fmax) + '_' + dtype_device
|
66 |
-
if fmax_dtype_device not in mel_basis:
|
67 |
-
mel = librosa_mel_fn(sampling_rate, n_fft, num_mels, fmin, fmax)
|
68 |
-
mel_basis[fmax_dtype_device] = torch.from_numpy(mel).to(dtype=spec.dtype, device=spec.device)
|
69 |
-
spec = torch.matmul(mel_basis[fmax_dtype_device], spec)
|
70 |
-
spec = spectral_normalize_torch(spec)
|
71 |
-
return spec
|
72 |
-
|
73 |
-
|
74 |
-
def mel_spectrogram_torch(y, n_fft, num_mels, sampling_rate, hop_size, win_size, fmin, fmax, center=False):
|
75 |
-
if torch.min(y) < -1.:
|
76 |
-
print('min value is ', torch.min(y))
|
77 |
-
if torch.max(y) > 1.:
|
78 |
-
print('max value is ', torch.max(y))
|
79 |
-
|
80 |
-
global mel_basis, hann_window
|
81 |
-
dtype_device = str(y.dtype) + '_' + str(y.device)
|
82 |
-
fmax_dtype_device = str(fmax) + '_' + dtype_device
|
83 |
-
wnsize_dtype_device = str(win_size) + '_' + dtype_device
|
84 |
-
if fmax_dtype_device not in mel_basis:
|
85 |
-
mel = librosa_mel_fn(sampling_rate, n_fft, num_mels, fmin, fmax)
|
86 |
-
mel_basis[fmax_dtype_device] = torch.from_numpy(mel).to(dtype=y.dtype, device=y.device)
|
87 |
-
if wnsize_dtype_device not in hann_window:
|
88 |
-
hann_window[wnsize_dtype_device] = torch.hann_window(win_size).to(dtype=y.dtype, device=y.device)
|
89 |
-
|
90 |
-
y = torch.nn.functional.pad(y.unsqueeze(1), (int((n_fft-hop_size)/2), int((n_fft-hop_size)/2)), mode='reflect')
|
91 |
-
y = y.squeeze(1)
|
92 |
-
|
93 |
-
spec = torch.stft(y, n_fft, hop_length=hop_size, win_length=win_size, window=hann_window[wnsize_dtype_device],
|
94 |
-
center=center, pad_mode='reflect', normalized=False, onesided=True)
|
95 |
-
|
96 |
-
spec = torch.sqrt(spec.pow(2).sum(-1) + 1e-6)
|
97 |
-
|
98 |
-
spec = torch.matmul(mel_basis[fmax_dtype_device], spec)
|
99 |
-
spec = spectral_normalize_torch(spec)
|
100 |
-
|
101 |
-
return spec
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/DragGan/DragGan-Inversion/torch_utils/ops/upfirdn2d.cpp
DELETED
@@ -1,107 +0,0 @@
|
|
1 |
-
// Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
2 |
-
//
|
3 |
-
// NVIDIA CORPORATION and its licensors retain all intellectual property
|
4 |
-
// and proprietary rights in and to this software, related documentation
|
5 |
-
// and any modifications thereto. Any use, reproduction, disclosure or
|
6 |
-
// distribution of this software and related documentation without an express
|
7 |
-
// license agreement from NVIDIA CORPORATION is strictly prohibited.
|
8 |
-
|
9 |
-
#include <torch/extension.h>
|
10 |
-
#include <ATen/cuda/CUDAContext.h>
|
11 |
-
#include <c10/cuda/CUDAGuard.h>
|
12 |
-
#include "upfirdn2d.h"
|
13 |
-
|
14 |
-
//------------------------------------------------------------------------
|
15 |
-
|
16 |
-
static torch::Tensor upfirdn2d(torch::Tensor x, torch::Tensor f, int upx, int upy, int downx, int downy, int padx0, int padx1, int pady0, int pady1, bool flip, float gain)
|
17 |
-
{
|
18 |
-
// Validate arguments.
|
19 |
-
TORCH_CHECK(x.is_cuda(), "x must reside on CUDA device");
|
20 |
-
TORCH_CHECK(f.device() == x.device(), "f must reside on the same device as x");
|
21 |
-
TORCH_CHECK(f.dtype() == torch::kFloat, "f must be float32");
|
22 |
-
TORCH_CHECK(x.numel() <= INT_MAX, "x is too large");
|
23 |
-
TORCH_CHECK(f.numel() <= INT_MAX, "f is too large");
|
24 |
-
TORCH_CHECK(x.numel() > 0, "x has zero size");
|
25 |
-
TORCH_CHECK(f.numel() > 0, "f has zero size");
|
26 |
-
TORCH_CHECK(x.dim() == 4, "x must be rank 4");
|
27 |
-
TORCH_CHECK(f.dim() == 2, "f must be rank 2");
|
28 |
-
TORCH_CHECK((x.size(0)-1)*x.stride(0) + (x.size(1)-1)*x.stride(1) + (x.size(2)-1)*x.stride(2) + (x.size(3)-1)*x.stride(3) <= INT_MAX, "x memory footprint is too large");
|
29 |
-
TORCH_CHECK(f.size(0) >= 1 && f.size(1) >= 1, "f must be at least 1x1");
|
30 |
-
TORCH_CHECK(upx >= 1 && upy >= 1, "upsampling factor must be at least 1");
|
31 |
-
TORCH_CHECK(downx >= 1 && downy >= 1, "downsampling factor must be at least 1");
|
32 |
-
|
33 |
-
// Create output tensor.
|
34 |
-
const at::cuda::OptionalCUDAGuard device_guard(device_of(x));
|
35 |
-
int outW = ((int)x.size(3) * upx + padx0 + padx1 - (int)f.size(1) + downx) / downx;
|
36 |
-
int outH = ((int)x.size(2) * upy + pady0 + pady1 - (int)f.size(0) + downy) / downy;
|
37 |
-
TORCH_CHECK(outW >= 1 && outH >= 1, "output must be at least 1x1");
|
38 |
-
torch::Tensor y = torch::empty({x.size(0), x.size(1), outH, outW}, x.options(), x.suggest_memory_format());
|
39 |
-
TORCH_CHECK(y.numel() <= INT_MAX, "output is too large");
|
40 |
-
TORCH_CHECK((y.size(0)-1)*y.stride(0) + (y.size(1)-1)*y.stride(1) + (y.size(2)-1)*y.stride(2) + (y.size(3)-1)*y.stride(3) <= INT_MAX, "output memory footprint is too large");
|
41 |
-
|
42 |
-
// Initialize CUDA kernel parameters.
|
43 |
-
upfirdn2d_kernel_params p;
|
44 |
-
p.x = x.data_ptr();
|
45 |
-
p.f = f.data_ptr<float>();
|
46 |
-
p.y = y.data_ptr();
|
47 |
-
p.up = make_int2(upx, upy);
|
48 |
-
p.down = make_int2(downx, downy);
|
49 |
-
p.pad0 = make_int2(padx0, pady0);
|
50 |
-
p.flip = (flip) ? 1 : 0;
|
51 |
-
p.gain = gain;
|
52 |
-
p.inSize = make_int4((int)x.size(3), (int)x.size(2), (int)x.size(1), (int)x.size(0));
|
53 |
-
p.inStride = make_int4((int)x.stride(3), (int)x.stride(2), (int)x.stride(1), (int)x.stride(0));
|
54 |
-
p.filterSize = make_int2((int)f.size(1), (int)f.size(0));
|
55 |
-
p.filterStride = make_int2((int)f.stride(1), (int)f.stride(0));
|
56 |
-
p.outSize = make_int4((int)y.size(3), (int)y.size(2), (int)y.size(1), (int)y.size(0));
|
57 |
-
p.outStride = make_int4((int)y.stride(3), (int)y.stride(2), (int)y.stride(1), (int)y.stride(0));
|
58 |
-
p.sizeMajor = (p.inStride.z == 1) ? p.inSize.w : p.inSize.w * p.inSize.z;
|
59 |
-
p.sizeMinor = (p.inStride.z == 1) ? p.inSize.z : 1;
|
60 |
-
|
61 |
-
// Choose CUDA kernel.
|
62 |
-
upfirdn2d_kernel_spec spec;
|
63 |
-
AT_DISPATCH_FLOATING_TYPES_AND_HALF(x.scalar_type(), "upfirdn2d_cuda", [&]
|
64 |
-
{
|
65 |
-
spec = choose_upfirdn2d_kernel<scalar_t>(p);
|
66 |
-
});
|
67 |
-
|
68 |
-
// Set looping options.
|
69 |
-
p.loopMajor = (p.sizeMajor - 1) / 16384 + 1;
|
70 |
-
p.loopMinor = spec.loopMinor;
|
71 |
-
p.loopX = spec.loopX;
|
72 |
-
p.launchMinor = (p.sizeMinor - 1) / p.loopMinor + 1;
|
73 |
-
p.launchMajor = (p.sizeMajor - 1) / p.loopMajor + 1;
|
74 |
-
|
75 |
-
// Compute grid size.
|
76 |
-
dim3 blockSize, gridSize;
|
77 |
-
if (spec.tileOutW < 0) // large
|
78 |
-
{
|
79 |
-
blockSize = dim3(4, 32, 1);
|
80 |
-
gridSize = dim3(
|
81 |
-
((p.outSize.y - 1) / blockSize.x + 1) * p.launchMinor,
|
82 |
-
(p.outSize.x - 1) / (blockSize.y * p.loopX) + 1,
|
83 |
-
p.launchMajor);
|
84 |
-
}
|
85 |
-
else // small
|
86 |
-
{
|
87 |
-
blockSize = dim3(256, 1, 1);
|
88 |
-
gridSize = dim3(
|
89 |
-
((p.outSize.y - 1) / spec.tileOutH + 1) * p.launchMinor,
|
90 |
-
(p.outSize.x - 1) / (spec.tileOutW * p.loopX) + 1,
|
91 |
-
p.launchMajor);
|
92 |
-
}
|
93 |
-
|
94 |
-
// Launch CUDA kernel.
|
95 |
-
void* args[] = {&p};
|
96 |
-
AT_CUDA_CHECK(cudaLaunchKernel(spec.kernel, gridSize, blockSize, args, 0, at::cuda::getCurrentCUDAStream()));
|
97 |
-
return y;
|
98 |
-
}
|
99 |
-
|
100 |
-
//------------------------------------------------------------------------
|
101 |
-
|
102 |
-
PYBIND11_MODULE(TORCH_EXTENSION_NAME, m)
|
103 |
-
{
|
104 |
-
m.def("upfirdn2d", &upfirdn2d);
|
105 |
-
}
|
106 |
-
|
107 |
-
//------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaces/EronSamez/RVC_HFmeu/lib/globals/globals.py
DELETED
@@ -1,5 +0,0 @@
|
|
1 |
-
DoFormant: bool = False
|
2 |
-
Quefrency: float = 8.0
|
3 |
-
Timbre: float = 1.2
|
4 |
-
|
5 |
-
NotesOrHertz: bool = False
|
|
|
|
|
|
|
|
|
|
|
|
spaces/EsoCode/text-generation-webui/css/main.js
DELETED
@@ -1,18 +0,0 @@
|
|
1 |
-
document.getElementById("main").parentNode.childNodes[0].classList.add("header_bar");
|
2 |
-
document.getElementById("main").parentNode.style = "padding: 0; margin: 0";
|
3 |
-
document.getElementById("main").parentNode.parentNode.parentNode.style = "padding: 0";
|
4 |
-
|
5 |
-
// Get references to the elements
|
6 |
-
let main = document.getElementById('main');
|
7 |
-
let main_parent = main.parentNode;
|
8 |
-
let extensions = document.getElementById('extensions');
|
9 |
-
|
10 |
-
// Add an event listener to the main element
|
11 |
-
main_parent.addEventListener('click', function(e) {
|
12 |
-
// Check if the main element is visible
|
13 |
-
if (main.offsetHeight > 0 && main.offsetWidth > 0) {
|
14 |
-
extensions.style.display = 'flex';
|
15 |
-
} else {
|
16 |
-
extensions.style.display = 'none';
|
17 |
-
}
|
18 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|