test git import
Browse files
app.py
CHANGED
@@ -1,6 +1,27 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
2 |
|
3 |
def process(git_repo_url, space_destination, user_token):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
return "hello"
|
5 |
|
6 |
css = """
|
|
|
1 |
import gradio as gr
|
2 |
+
import tempfile
|
3 |
+
import os
|
4 |
+
from git import Repo
|
5 |
+
|
6 |
|
7 |
def process(git_repo_url, space_destination, user_token):
|
8 |
+
# Create a temporary directory to clone the repository
|
9 |
+
tmp_dir = tempfile.mkdtemp()
|
10 |
+
|
11 |
+
# Clone the Hugging Face Spaces repository
|
12 |
+
repo = Repo.clone_from(git_repo_url, tmp_dir)
|
13 |
+
|
14 |
+
# Log the contents of the tmp_dir with its subfolders
|
15 |
+
print("Contents of the cloned repository:")
|
16 |
+
for root, dirs, files in os.walk(tmp_dir):
|
17 |
+
level = root.replace(tmp_dir, '').count(os.sep)
|
18 |
+
indent = ' ' * 4 * level
|
19 |
+
print(f"{indent}{os.path.basename(root)}/")
|
20 |
+
sub_indent = ' ' * 4 * (level + 1)
|
21 |
+
for f in files:
|
22 |
+
print(f"{sub_indent}{f}")
|
23 |
+
|
24 |
+
|
25 |
return "hello"
|
26 |
|
27 |
css = """
|