Update app.py
Browse files
app.py
CHANGED
@@ -1,28 +1,38 @@
|
|
|
|
1 |
import subprocess
|
2 |
-
import streamlit as st
|
3 |
-
import os
|
4 |
|
5 |
def clone_github_repo(repo_url, destination_folder=None):
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
8 |
try:
|
9 |
-
|
10 |
-
|
11 |
-
|
|
|
12 |
except subprocess.CalledProcessError as e:
|
13 |
-
|
14 |
-
st.text(e.stderr)
|
15 |
-
|
16 |
-
st.title("GitHub Repository Cloner")
|
17 |
-
repo_url = st.text_input("Enter GitHub Repository URL", "https://github.com/NebulaServices/Nebula")
|
18 |
-
destination_folder = st.text_input("Enter Destination Folder (Optional)")
|
19 |
-
|
20 |
-
if st.button("Clone Repository"):
|
21 |
-
clone_github_repo(repo_url, destination_folder)
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
-
|
28 |
-
|
|
|
1 |
+
import gradio as gr
|
2 |
import subprocess
|
|
|
|
|
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 |
+
if destination_folder is None:
|
13 |
+
destination_folder = repo_url.split('/')[-1].replace('.git', '')
|
14 |
+
subprocess.run(["git", "clone", repo_url, destination_folder], check=True)
|
15 |
+
return f"リポジトリ {repo_url} を {destination_folder} にクローンしました。"
|
16 |
except subprocess.CalledProcessError as e:
|
17 |
+
return f"リポジトリのクローンに失敗しました: {e}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
+
def main():
|
20 |
+
# GitHubリポジトリのURL
|
21 |
+
repo_url = "https://github.com/NebulaServices/Nebula"
|
22 |
+
|
23 |
+
# クローン処理
|
24 |
+
clone_message = clone_github_repo(repo_url)
|
25 |
+
|
26 |
+
# Gradioインターフェースの作成
|
27 |
+
iface = gr.Interface(
|
28 |
+
fn=lambda: clone_message,
|
29 |
+
inputs=[],
|
30 |
+
outputs="text",
|
31 |
+
title="GitHub Repository Cloner",
|
32 |
+
description="GitHubリポジトリをクローンするアプリケーションです。"
|
33 |
+
)
|
34 |
+
|
35 |
+
iface.launch(server_name="0.0.0.0", server_port=7860)
|
36 |
|
37 |
+
if __name__ == "__main__":
|
38 |
+
main()
|