cookie / app.py
soiz's picture
Update app.py
305b2db verified
raw
history blame
994 Bytes
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()
# Gradioアプリの作成
def display_index():
# index.htmlをHTMLとして読み込む
with open("index.html", "r") as file:
html_content = file.read()
return html_content
# Gradioインターフェースの設定
iface = gr.Interface(
fn=display_index,
inputs=None,
outputs="html",
live=True
)
if __name__ == "__main__":
iface.launch()