File size: 1,111 Bytes
5312808
305b2db
5312808
63e1b1c
 
305b2db
 
 
 
63e1b1c
 
305b2db
 
 
 
63e1b1c
 
 
 
 
5312808
d7f832a
305b2db
 
 
 
5312808
d7f832a
 
 
 
 
 
 
5312808
d7f832a
305b2db
d7f832a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import os
import gradio as gr

# リポジトリのクローンを行う
def clone_repo():
    # クローンしたかどうかを判定するファイル
    clone_flag = "repo_cloned.flag"
    
    if not os.path.exists(clone_flag):
        print("Cloning the repository...")
        os.system("git clone https://github.com/ozh/cookieclicker.git .")
        
        # クローン完了後にフラグファイルを作成
        with open(clone_flag, 'w') as f:
            f.write("Repository has been cloned.")
    else:
        print("Repository already cloned.")

# クローンを実行
clone_repo()

# index.htmlの内容を読み込む関数
def display_index():
    with open("index.html", "r") as file:
        html_content = file.read()
    return html_content

# Gradioアプリの設定
with gr.Blocks() as app:
    # `HTML`コンポーネントで`index.html`の内容を表示
    html_display = gr.HTML()
    
    # ページロード時にdisplay_indexを自動実行
    app.load(display_index, outputs=html_display)

# Gradioアプリを起動
if __name__ == "__main__":
    app.launch()