nebla / app.py
soiz's picture
Update app.py
b372f0d verified
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()