aliabd HF Staff commited on
Commit
97d2b24
·
1 Parent(s): d932761

Upload with huggingface_hub

Browse files
Files changed (5) hide show
  1. README.md +6 -7
  2. __pycache__/run.cpython-36.pyc +0 -0
  3. requirements.txt +2 -0
  4. run.py +39 -0
  5. screenshot.png +0 -0
README.md CHANGED
@@ -1,12 +1,11 @@
 
1
  ---
2
- title: Stock Forecast Main
3
- emoji: 💻
4
- colorFrom: yellow
5
- colorTo: yellow
6
  sdk: gradio
7
  sdk_version: 3.6
8
- app_file: app.py
9
  pinned: false
10
  ---
11
-
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
+
2
  ---
3
+ title: stock_forecast_main
4
+ emoji: 🔥
5
+ colorFrom: indigo
6
+ colorTo: indigo
7
  sdk: gradio
8
  sdk_version: 3.6
9
+ app_file: run.py
10
  pinned: false
11
  ---
 
 
__pycache__/run.cpython-36.pyc ADDED
Binary file (1.23 kB). View file
 
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ numpy
2
+ matplotlibhttps://gradio-main-build.s3.amazonaws.com/c3bec6153737855510542e8154391f328ac72606/gradio-3.6-py3-none-any.whl
run.py ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import matplotlib
2
+ matplotlib.use('Agg')
3
+ import matplotlib.pyplot as plt
4
+ import numpy as np
5
+
6
+ import gradio as gr
7
+
8
+
9
+ def plot_forecast(final_year, companies, noise, show_legend, point_style):
10
+ start_year = 2020
11
+ x = np.arange(start_year, final_year + 1)
12
+ year_count = x.shape[0]
13
+ plt_format = ({"cross": "X", "line": "-", "circle": "o--"})[point_style]
14
+ fig = plt.figure()
15
+ ax = fig.add_subplot(111)
16
+ for i, company in enumerate(companies):
17
+ series = np.arange(0, year_count, dtype=float)
18
+ series = series**2 * (i + 1)
19
+ series += np.random.rand(year_count) * noise
20
+ ax.plot(x, series, plt_format)
21
+ if show_legend:
22
+ plt.legend(companies)
23
+ return fig
24
+
25
+
26
+ demo = gr.Interface(
27
+ plot_forecast,
28
+ [
29
+ gr.Radio([2025, 2030, 2035, 2040], label="Project to:"),
30
+ gr.CheckboxGroup(["Google", "Microsoft", "Gradio"], label="Company Selection"),
31
+ gr.Slider(1, 100, label="Noise Level"),
32
+ gr.Checkbox(label="Show Legend"),
33
+ gr.Dropdown(["cross", "line", "circle"], label="Style"),
34
+ ],
35
+ gr.Plot(label="forecast"),
36
+ )
37
+
38
+ if __name__ == "__main__":
39
+ demo.launch()
screenshot.png ADDED