aliabd HF staff commited on
Commit
8bbdb00
·
verified ·
1 Parent(s): 3f9062b

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 +10 -10
requirements.txt CHANGED
@@ -1,2 +1,2 @@
1
- gradio-client @ git+https://github.com/gradio-app/gradio@b729f10321b571e7de418596d1cf605773b0b8e6#subdirectory=client/python
2
- https://gradio-builds.s3.amazonaws.com/b729f10321b571e7de418596d1cf605773b0b8e6/gradio-4.25.0-py3-none-any.whl
 
1
+ gradio-client @ git+https://github.com/gradio-app/gradio@867ff16cd47ceb5bbf076503538a262b6fe64638#subdirectory=client/python
2
+ https://gradio-builds.s3.amazonaws.com/867ff16cd47ceb5bbf076503538a262b6fe64638/gradio-4.25.0-py3-none-any.whl
run.ipynb CHANGED
@@ -1 +1 @@
1
- {"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: code_component"]}, {"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", " gr.Code(\n", " value=\"\"\"def hello_world():\n", " return \"Hello, world!\"\n", " \n", "print(hello_world())\"\"\",\n", " language=\"python\",\n", " interactive=True,\n", " show_label=False,\n", " )\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
 
1
+ {"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: code_component"]}, {"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", "from pathlib import Path\n", "\n", "demo = gr.Interface(\n", " lambda x: x,\n", " gr.Code(language=\"python\"),\n", " gr.Code(language=\"python\"),\n", " examples=[[(\"/Users/freddy/sources/gradio/demo/code_component/run.py\",)],\n", " [\"print('Hello, World!')\"],\n", " [(\"/Users/freddy/sources/gradio/demo/code/run.py\", )]]\n", ")\n", "\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
run.py CHANGED
@@ -1,15 +1,15 @@
1
  import gradio as gr
 
 
 
 
 
 
 
 
 
 
2
 
3
- with gr.Blocks() as demo:
4
- gr.Code(
5
- value="""def hello_world():
6
- return "Hello, world!"
7
-
8
- print(hello_world())""",
9
- language="python",
10
- interactive=True,
11
- show_label=False,
12
- )
13
 
14
  if __name__ == "__main__":
15
  demo.launch()
 
1
  import gradio as gr
2
+ from pathlib import Path
3
+
4
+ demo = gr.Interface(
5
+ lambda x: x,
6
+ gr.Code(language="python"),
7
+ gr.Code(language="python"),
8
+ examples=[[("/Users/freddy/sources/gradio/demo/code_component/run.py",)],
9
+ ["print('Hello, World!')"],
10
+ [("/Users/freddy/sources/gradio/demo/code/run.py", )]]
11
+ )
12
 
 
 
 
 
 
 
 
 
 
 
13
 
14
  if __name__ == "__main__":
15
  demo.launch()