freddyaboulton HF Staff commited on
Commit
f086ec9
·
verified ·
1 Parent(s): 39b9b3a

Upload folder using huggingface_hub

Browse files
Files changed (4) hide show
  1. README.md +1 -1
  2. requirements.txt +2 -2
  3. run.ipynb +1 -1
  4. run.py +0 -1
README.md CHANGED
@@ -5,7 +5,7 @@ emoji: 🔥
5
  colorFrom: indigo
6
  colorTo: indigo
7
  sdk: gradio
8
- sdk_version: 5.49.1
9
  app_file: run.py
10
  pinned: false
11
  hf_oauth: true
 
5
  colorFrom: indigo
6
  colorTo: indigo
7
  sdk: gradio
8
+ sdk_version: 6.0.0
9
  app_file: run.py
10
  pinned: false
11
  hf_oauth: true
requirements.txt CHANGED
@@ -1,5 +1,5 @@
1
- gradio-client @ git+https://github.com/gradio-app/gradio@e05eb8df38a4ca20993e94ca4e209cf8110bb677#subdirectory=client/python
2
- https://gradio-pypi-previews.s3.amazonaws.com/e05eb8df38a4ca20993e94ca4e209cf8110bb677/gradio-5.49.1-py3-none-any.whl
3
  numpy
4
  pandas
5
  plotly
 
1
+ gradio-client @ git+https://github.com/gradio-app/gradio@d007e6cf617baba5c62e49ec2b7ce278aa863a79#subdirectory=client/python
2
+ https://gradio-pypi-previews.s3.amazonaws.com/d007e6cf617baba5c62e49ec2b7ce278aa863a79/gradio-6.0.0-py3-none-any.whl
3
  numpy
4
  pandas
5
  plotly
run.ipynb CHANGED
@@ -1 +1 @@
1
- {"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: live_dashboard\n", "### This demo shows how you can build a live interactive dashboard with gradio.\n", "The current time is refreshed every second and the plot every half second by using the 'every' keyword in the event handler.\n", "Changing the value of the slider will control the period of the sine curve (the distance between peaks). \n", " "]}, {"cell_type": "code", "execution_count": null, "id": "272996653310673477252411125948039410165", "metadata": {}, "outputs": [], "source": ["!pip install -q gradio numpy pandas plotly "]}, {"cell_type": "code", "execution_count": null, "id": "288918539441861185822528903084949547379", "metadata": {}, "outputs": [], "source": ["import math\n", "\n", "import pandas as pd\n", "\n", "import gradio as gr\n", "import datetime\n", "import numpy as np\n", "\n", "def get_time():\n", " return datetime.datetime.now()\n", "\n", "plot_end = 2 * math.pi\n", "\n", "def get_plot(period=1):\n", " global plot_end\n", " x = np.arange(plot_end - 2 * math.pi, plot_end, 0.02)\n", " y = np.sin(2 * math.pi * period * x)\n", " update = gr.LinePlot(\n", " value=pd.DataFrame({\"x\": x, \"y\": y}),\n", " x=\"x\",\n", " y=\"y\",\n", " title=\"Plot (updates every second)\",\n", " width=600,\n", " height=350,\n", " )\n", " plot_end += 0.1\n", " return update\n", "\n", "with gr.Blocks() as demo:\n", " with gr.Row():\n", " with gr.Column():\n", " c_time2 = gr.Textbox(label=\"Current Time refreshed every second\")\n", " period = gr.Slider(\n", " label=\"Period of plot\", value=1, minimum=0, maximum=10\n", " )\n", " plot = gr.LinePlot(show_label=False)\n", " with gr.Column():\n", " start_time = gr.Textbox(label=\"Start Time\")\n", " end_time = gr.Textbox(label=\"End Time\")\n", "\n", " timer = gr.Timer(1)\n", "\n", " timer.tick(lambda: datetime.datetime.now(), None, c_time2)\n", " timer.tick(get_plot, period, plot)\n", "\n", " def select(selection_range: gr.SelectData):\n", " return gr.LinePlot(x_lim=selection_range.index), selection_range.index[0], selection_range.index[1]\n", " plot.select(select, None, [plot, start_time, end_time])\n", " plot.double_click(lambda: gr.LinePlot(x_lim=None), None, plot)\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: live_dashboard\n", "### This demo shows how you can build a live interactive dashboard with gradio.\n", "The current time is refreshed every second and the plot every half second by using the 'every' keyword in the event handler.\n", "Changing the value of the slider will control the period of the sine curve (the distance between peaks). \n", " "]}, {"cell_type": "code", "execution_count": null, "id": "272996653310673477252411125948039410165", "metadata": {}, "outputs": [], "source": ["!pip install -q gradio numpy pandas plotly "]}, {"cell_type": "code", "execution_count": null, "id": "288918539441861185822528903084949547379", "metadata": {}, "outputs": [], "source": ["import math\n", "\n", "import pandas as pd\n", "\n", "import gradio as gr\n", "import datetime\n", "import numpy as np\n", "\n", "def get_time():\n", " return datetime.datetime.now()\n", "\n", "plot_end = 2 * math.pi\n", "\n", "def get_plot(period=1):\n", " global plot_end\n", " x = np.arange(plot_end - 2 * math.pi, plot_end, 0.02)\n", " y = np.sin(2 * math.pi * period * x)\n", " update = gr.LinePlot(\n", " value=pd.DataFrame({\"x\": x, \"y\": y}),\n", " x=\"x\",\n", " y=\"y\",\n", " title=\"Plot (updates every second)\",\n", " height=350,\n", " )\n", " plot_end += 0.1\n", " return update\n", "\n", "with gr.Blocks() as demo:\n", " with gr.Row():\n", " with gr.Column():\n", " c_time2 = gr.Textbox(label=\"Current Time refreshed every second\")\n", " period = gr.Slider(\n", " label=\"Period of plot\", value=1, minimum=0, maximum=10\n", " )\n", " plot = gr.LinePlot(show_label=False)\n", " with gr.Column():\n", " start_time = gr.Textbox(label=\"Start Time\")\n", " end_time = gr.Textbox(label=\"End Time\")\n", "\n", " timer = gr.Timer(1)\n", "\n", " timer.tick(lambda: datetime.datetime.now(), None, c_time2)\n", " timer.tick(get_plot, period, plot)\n", "\n", " def select(selection_range: gr.SelectData):\n", " return gr.LinePlot(x_lim=selection_range.index), selection_range.index[0], selection_range.index[1]\n", " plot.select(select, None, [plot, start_time, end_time])\n", " plot.double_click(lambda: gr.LinePlot(x_lim=None), None, plot)\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
run.py CHANGED
@@ -20,7 +20,6 @@ def get_plot(period=1):
20
  x="x",
21
  y="y",
22
  title="Plot (updates every second)",
23
- width=600,
24
  height=350,
25
  )
26
  plot_end += 0.1
 
20
  x="x",
21
  y="y",
22
  title="Plot (updates every second)",
 
23
  height=350,
24
  )
25
  plot_end += 0.1