Update app.py
Browse files
app.py
CHANGED
@@ -1,24 +1,38 @@
|
|
1 |
import os
|
2 |
-
|
3 |
|
4 |
# リポジトリのクローンを行う
|
5 |
def clone_repo():
|
6 |
-
#
|
7 |
-
|
|
|
|
|
8 |
print("Cloning the repository...")
|
9 |
os.system("git clone https://github.com/ozh/cookieclicker.git .")
|
|
|
|
|
|
|
|
|
10 |
else:
|
11 |
print("Repository already cloned.")
|
12 |
|
13 |
# クローンを実行
|
14 |
clone_repo()
|
15 |
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
-
#
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
22 |
|
23 |
-
if __name__ ==
|
24 |
-
|
|
|
1 |
import os
|
2 |
+
import gradio as gr
|
3 |
|
4 |
# リポジトリのクローンを行う
|
5 |
def clone_repo():
|
6 |
+
# クローンしたかどうかを判定するファイル
|
7 |
+
clone_flag = "repo_cloned.flag"
|
8 |
+
|
9 |
+
if not os.path.exists(clone_flag):
|
10 |
print("Cloning the repository...")
|
11 |
os.system("git clone https://github.com/ozh/cookieclicker.git .")
|
12 |
+
|
13 |
+
# クローン完了後にフラグファイルを作成
|
14 |
+
with open(clone_flag, 'w') as f:
|
15 |
+
f.write("Repository has been cloned.")
|
16 |
else:
|
17 |
print("Repository already cloned.")
|
18 |
|
19 |
# クローンを実行
|
20 |
clone_repo()
|
21 |
|
22 |
+
# Gradioアプリの作成
|
23 |
+
def display_index():
|
24 |
+
# index.htmlをHTMLとして読み込む
|
25 |
+
with open("index.html", "r") as file:
|
26 |
+
html_content = file.read()
|
27 |
+
return html_content
|
28 |
|
29 |
+
# Gradioインターフェースの設定
|
30 |
+
iface = gr.Interface(
|
31 |
+
fn=display_index,
|
32 |
+
inputs=None,
|
33 |
+
outputs="html",
|
34 |
+
live=True
|
35 |
+
)
|
36 |
|
37 |
+
if __name__ == "__main__":
|
38 |
+
iface.launch()
|