Spaces:
Sleeping
Sleeping
Upload with huggingface_hub
Browse files- DESCRIPTION.md +1 -0
- README.md +1 -1
- app.py +0 -8
DESCRIPTION.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Generate a plot based on 5 inputs.
|
README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
|
| 2 |
---
|
| 3 |
title: outbreak_forecast
|
| 4 |
-
emoji:
|
| 5 |
colorFrom: indigo
|
| 6 |
colorTo: indigo
|
| 7 |
sdk: gradio
|
|
|
|
| 1 |
|
| 2 |
---
|
| 3 |
title: outbreak_forecast
|
| 4 |
+
emoji: 🔥
|
| 5 |
colorFrom: indigo
|
| 6 |
colorTo: indigo
|
| 7 |
sdk: gradio
|
app.py
CHANGED
|
@@ -1,6 +1,3 @@
|
|
| 1 |
-
# URL: https://huggingface.co/spaces/gradio/outbreak_forecast
|
| 2 |
-
# DESCRIPTION: Generate a plot based on 5 inputs.
|
| 3 |
-
# imports
|
| 4 |
import gradio as gr
|
| 5 |
from math import sqrt
|
| 6 |
import matplotlib
|
|
@@ -11,7 +8,6 @@ import plotly.express as px
|
|
| 11 |
import pandas as pd
|
| 12 |
|
| 13 |
|
| 14 |
-
# define core fn
|
| 15 |
def outbreak(plot_type, r, month, countries, social_distancing):
|
| 16 |
months = ["January", "February", "March", "April", "May"]
|
| 17 |
m = months.index(month)
|
|
@@ -43,7 +39,6 @@ def outbreak(plot_type, r, month, countries, social_distancing):
|
|
| 43 |
else:
|
| 44 |
raise ValueError("A plot type must be selected")
|
| 45 |
|
| 46 |
-
# define inputs
|
| 47 |
inputs = [
|
| 48 |
gr.Dropdown(["Matplotlib", "Plotly"], label="Plot Type"),
|
| 49 |
gr.Slider(1, 4, 3.2, label="R"),
|
|
@@ -52,14 +47,11 @@ inputs = [
|
|
| 52 |
value=["USA", "Canada"]),
|
| 53 |
gr.Checkbox(label="Social Distancing?"),
|
| 54 |
]
|
| 55 |
-
# define output
|
| 56 |
outputs = gr.Plot()
|
| 57 |
|
| 58 |
-
# define interface
|
| 59 |
demo = gr.Interface(fn=outbreak, inputs=inputs, outputs=outputs, examples=[
|
| 60 |
["Matplotlib", 2, "March", ["Mexico", "UK"], True],
|
| 61 |
["Plotly", 3.6, "February", ["Canada", "Mexico", "UK"], False],
|
| 62 |
], cache_examples=True)
|
| 63 |
|
| 64 |
-
# launch
|
| 65 |
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from math import sqrt
|
| 3 |
import matplotlib
|
|
|
|
| 8 |
import pandas as pd
|
| 9 |
|
| 10 |
|
|
|
|
| 11 |
def outbreak(plot_type, r, month, countries, social_distancing):
|
| 12 |
months = ["January", "February", "March", "April", "May"]
|
| 13 |
m = months.index(month)
|
|
|
|
| 39 |
else:
|
| 40 |
raise ValueError("A plot type must be selected")
|
| 41 |
|
|
|
|
| 42 |
inputs = [
|
| 43 |
gr.Dropdown(["Matplotlib", "Plotly"], label="Plot Type"),
|
| 44 |
gr.Slider(1, 4, 3.2, label="R"),
|
|
|
|
| 47 |
value=["USA", "Canada"]),
|
| 48 |
gr.Checkbox(label="Social Distancing?"),
|
| 49 |
]
|
|
|
|
| 50 |
outputs = gr.Plot()
|
| 51 |
|
|
|
|
| 52 |
demo = gr.Interface(fn=outbreak, inputs=inputs, outputs=outputs, examples=[
|
| 53 |
["Matplotlib", 2, "March", ["Mexico", "UK"], True],
|
| 54 |
["Plotly", 3.6, "February", ["Canada", "Mexico", "UK"], False],
|
| 55 |
], cache_examples=True)
|
| 56 |
|
|
|
|
| 57 |
demo.launch()
|