File size: 1,375 Bytes
b372f0d
2eadae7
 
 
b372f0d
 
 
 
 
 
2eadae7
b372f0d
 
 
 
2eadae7
b372f0d
1e6dd0c
b372f0d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1e6dd0c
b372f0d
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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()