|
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(): |
|
|
|
repo_url = "https://github.com/NebulaServices/Nebula" |
|
|
|
|
|
clone_message = clone_github_repo(repo_url) |
|
|
|
|
|
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() |
|
|