Download app.py from soiz/nebla: direct link, hf CLI and curl.
- Browser
- Download file 1.38 kB
-
https://huggingface.co/spaces/soiz/nebla/resolve/main/app.py
- Command line
-
hf download hf://spaces/soiz/nebla/app.py
-
curl -L -o app.py https://huggingface.co/spaces/soiz/nebla/resolve/main/app.py
1.38 kB
| import gradio as gr | |
| import subprocess | |
| def clone_github_repo(repo_url, destination_folder=None): | |
| """ | |
| GitHubリポジトリをクローンします。 | |
| :param repo_url: クローンするリポジトリのURL | |
| :param destination_folder: 保存先フォルダのパス(指定しない場合、リポジトリ名が使用されます) | |
| """ | |
| try: | |
| if destination_folder is None: | |
| destination_folder = repo_url.split('/')[-1].replace('.git', '') | |
| subprocess.run(["git", "clone", repo_url, destination_folder], check=True) | |
| return f"リポジトリ {repo_url} を {destination_folder} にクローンしました。" | |
| except subprocess.CalledProcessError as e: | |
| return f"リポジトリのクローンに失敗しました: {e}" | |
| def main(): | |
| # GitHubリポジトリのURL | |
| repo_url = "https://github.com/NebulaServices/Nebula" | |
| # クローン処理 | |
| clone_message = clone_github_repo(repo_url) | |
| # Gradioインターフェースの作成 | |
| iface = gr.Interface( | |
| fn=lambda: clone_message, | |
| inputs=[], | |
| outputs="text", | |
| title="GitHub Repository Cloner", | |
| description="GitHubリポジトリをクローンするアプリケーションです。" | |
| ) | |
| iface.launch(server_name="0.0.0.0", server_port=7860) | |
| if __name__ == "__main__": | |
| main() | |