aliabd HF staff commited on
Commit
0466f23
·
verified ·
1 Parent(s): e2e3de0

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. requirements.txt +2 -2
  2. run.ipynb +1 -1
  3. run.py +1 -1
requirements.txt CHANGED
@@ -1,2 +1,2 @@
1
- gradio-client @ git+https://github.com/gradio-app/gradio@38c2ad425a905431b1eb17b9498669f9e49f0dd5#subdirectory=client/python
2
- https://gradio-builds.s3.amazonaws.com/38c2ad425a905431b1eb17b9498669f9e49f0dd5/gradio-4.38.1-py3-none-any.whl
 
1
+ gradio-client @ git+https://github.com/gradio-app/gradio@76c175935019833baef709a5cf401d2263ca72ee#subdirectory=client/python
2
+ https://gradio-builds.s3.amazonaws.com/76c175935019833baef709a5cf401d2263ca72ee/gradio-4.38.1-py3-none-any.whl
run.ipynb CHANGED
@@ -1 +1 @@
1
- {"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: tictactoe"]}, {"cell_type": "code", "execution_count": null, "id": "272996653310673477252411125948039410165", "metadata": {}, "outputs": [], "source": ["!pip install -q gradio "]}, {"cell_type": "code", "execution_count": null, "id": "288918539441861185822528903084949547379", "metadata": {}, "outputs": [], "source": ["import gradio as gr\n", "\n", "with gr.Blocks() as demo:\n", " turn = gr.Textbox(\"X\", interactive=False, label=\"Turn\")\n", " board = gr.Dataframe(value=[[\"\", \"\", \"\"]] * 3, interactive=False, type=\"array\")\n", "\n", " def place(board, turn, evt: gr.SelectData):\n", " if evt.value:\n", " return board, turn\n", " board[evt.index[0]][evt.index[1]] = turn\n", " turn = \"O\" if turn == \"X\" else \"X\"\n", " return board, turn\n", "\n", " board.select(place, [board, turn], [board, turn], show_progress=\"hidden\")\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
 
1
+ {"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: tictactoe"]}, {"cell_type": "code", "execution_count": null, "id": "272996653310673477252411125948039410165", "metadata": {}, "outputs": [], "source": ["!pip install -q gradio "]}, {"cell_type": "code", "execution_count": null, "id": "288918539441861185822528903084949547379", "metadata": {}, "outputs": [], "source": ["import gradio as gr\n", "\n", "with gr.Blocks() as demo:\n", " turn = gr.Textbox(\"X\", interactive=False, label=\"Turn\")\n", " board = gr.Dataframe(value=[[\"\", \"\", \"\"]] * 3, interactive=False, type=\"array\")\n", "\n", " def place(board: list[list[int]], turn, evt: gr.SelectData): # type: ignore\n", " if evt.value:\n", " return board, turn\n", " board[evt.index[0]][evt.index[1]] = turn\n", " turn = \"O\" if turn == \"X\" else \"X\"\n", " return board, turn\n", "\n", " board.select(place, [board, turn], [board, turn], show_progress=\"hidden\")\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
run.py CHANGED
@@ -4,7 +4,7 @@ with gr.Blocks() as demo:
4
  turn = gr.Textbox("X", interactive=False, label="Turn")
5
  board = gr.Dataframe(value=[["", "", ""]] * 3, interactive=False, type="array")
6
 
7
- def place(board, turn, evt: gr.SelectData):
8
  if evt.value:
9
  return board, turn
10
  board[evt.index[0]][evt.index[1]] = turn
 
4
  turn = gr.Textbox("X", interactive=False, label="Turn")
5
  board = gr.Dataframe(value=[["", "", ""]] * 3, interactive=False, type="array")
6
 
7
+ def place(board: list[list[int]], turn, evt: gr.SelectData): # type: ignore
8
  if evt.value:
9
  return board, turn
10
  board[evt.index[0]][evt.index[1]] = turn