Spaces:
Runtime error
Runtime error
Download main.py from FaridaYasserEl-Lahamy/zpSearchFastAPI: direct link, hf CLI and curl.
- Browser
- Download file 932 Bytes
-
https://huggingface.co/spaces/FaridaYasserEl-Lahamy/zpSearchFastAPI/resolve/main/main.py
- Command line
-
hf download hf://spaces/FaridaYasserEl-Lahamy/zpSearchFastAPI/main.py
-
curl -L -o main.py https://huggingface.co/spaces/FaridaYasserEl-Lahamy/zpSearchFastAPI/resolve/main/main.py
932 Bytes
| import os | |
| import time | |
| import shutil | |
| import subprocess | |
| gh_token = os.getenv("gh_token") | |
| url_with_token = f"https://{gh_token}@github.com/FaridaYasserYoussef/zpSearchFastAPI" | |
| os.system(f"git clone {url_with_token}") | |
| time.sleep(10) | |
| source_dir = "zpSearchFastAPI" | |
| destination_dir = "." | |
| for item in os.listdir(source_dir): | |
| s = os.path.join(source_dir, item) | |
| d = os.path.join(destination_dir, item) | |
| shutil.move(s, d) | |
| os.rmdir(source_dir) | |
| with open("requirements.txt", "r", encoding="utf-8") as file: | |
| lines = file.readlines() | |
| with open("requirements.txt", "w", encoding="utf-8") as file: | |
| for line in lines: | |
| if "numpy==2.1.2" in line: | |
| file.write(line.replace("2.1.2", "2.0.2")) | |
| else: | |
| file.write(line) | |
| command = ["pip", "install", "-r", "requirements.txt"] | |
| subprocess.run(command, check=True) | |
| with open("main.py", "r") as file: | |
| code = file.read() | |
| exec(code) | |