soiz commited on
Commit
79ad461
·
verified ·
1 Parent(s): b3e04b6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -19
app.py CHANGED
@@ -1,25 +1,20 @@
1
  import subprocess
2
- import gradio
3
 
4
  def clone_github_repo(repo_url, destination_folder=None):
5
- """
6
- GitHubリポジトリをクローンします。
7
-
8
- :param repo_url: クローンするリポジトリのURL
9
- :param destination_folder: 保存先フォルダのパス(指定しない場合、リポジトリ名が使用されます)
10
- """
11
  try:
12
- # destination_folderが指定されていない場合、リポジトリ名を取得して設定する
13
- if destination_folder is None:
14
- destination_folder = repo_url.split('/')[-1].replace('.git', '')
15
-
16
- # git clone コマンドを実行
17
- subprocess.run(["git", "clone", repo_url, destination_folder], check=True)
18
- print(f"リポジトリ {repo_url} を {destination_folder} にクローンしました。")
19
  except subprocess.CalledProcessError as e:
20
- print(f"リポジトリのクローンに失敗しました: {e}")
 
 
 
 
 
21
 
22
- # 使用例
23
- repo_url = "https://github.com/NebulaServices/Nebula"
24
- clone_github_repo(repo_url)
25
- gradio.load()
 
1
  import subprocess
2
+ import streamlit as st
3
 
4
  def clone_github_repo(repo_url, destination_folder=None):
5
+ if destination_folder is None:
6
+ destination_folder = repo_url.split('/')[-1].replace('.git', '')
 
 
 
 
7
  try:
8
+ result = subprocess.run(["git", "clone", repo_url, destination_folder], check=True, capture_output=True, text=True)
9
+ st.success(f"Repository cloned successfully: {repo_url} -> {destination_folder}")
10
+ st.text(result.stdout)
 
 
 
 
11
  except subprocess.CalledProcessError as e:
12
+ st.error(f"Error cloning repository: {e}")
13
+ st.text(e.stderr)
14
+
15
+ st.title("GitHub Repository Cloner")
16
+ repo_url = st.text_input("Enter GitHub Repository URL", "https://github.com/NebulaServices/Nebula")
17
+ destination_folder = st.text_input("Enter Destination Folder (Optional)")
18
 
19
+ if st.button("Clone Repository"):
20
+ clone_github_repo(repo_url, destination_folder)