kramlion commited on
Commit
ac593fe
·
1 Parent(s): 46b090b
Files changed (2) hide show
  1. app.py +2 -44
  2. requirements.txt +0 -1
app.py CHANGED
@@ -1,7 +1,6 @@
1
  from huggingface_hub import hf_hub_download
2
  import tensorflow as tf
3
  import numpy as np
4
- import matplotlib.pyplot as plt
5
  import gradio as gr
6
 
7
 
@@ -11,42 +10,6 @@ model_path = hf_hub_download(repo_id="neuronetties/money", filename="money.keras
11
  # Загрузка модели
12
  model = tf.keras.models.load_model(model_path)
13
 
14
- def generate_plots(file):
15
- start_date = pd.to_datetime("30.06.2024", dayfirst=True) # Начальная дата
16
- date_range = pd.date_range(start=start_date, periods=6, freq='ME')
17
-
18
- plt.figure(figsize=(15, 10))
19
-
20
- plt.subplot(3, 1, 1)
21
- plt.plot(date_range, monthly_usd_rub, label='Курс Доллара к Рублю', color='red', marker='o')
22
- plt.title('Прогноз курса доллара к Рублю на 6 месяцев')
23
- plt.xlabel('Месяца')
24
- plt.ylabel('Цена Доллара в Рублях')
25
- plt.legend()
26
-
27
- plt.subplot(3, 1, 2)
28
- plt.plot(date_range, monthly_eur, label='Курс Евро к Рублю', color='blue', marker='o')
29
- plt.title('Прогноз курса Евро к Рублю на 6 месяцев')
30
- plt.xlabel('Месяца')
31
- plt.ylabel('Цена Евро в Рублях')
32
- plt.legend()
33
-
34
- plt.subplot(3, 1, 3)
35
- plt.plot(date_range, monthly_gbp, label='Курс Фунтов Стерлингов к Рублю', color='green', marker='o')
36
- plt.title('Прогноз курс Фунтов Стерлингов к Рублю на 6 месяцев')
37
- plt.xlabel('Месяца')
38
- plt.ylabel('Цена Фунтов Стерлингов в Рублях')
39
- plt.legend()
40
-
41
- plt.tight_layout()
42
-
43
- # Сохранение графиков в файл
44
- plot_file_path = "predictions.png"
45
- plt.savefig(plot_file_path)
46
-
47
- return plot_file_path
48
-
49
-
50
  def get_currency_values(file, date_input):
51
  # Чтение данных из Excel файла
52
  data = pd.read_excel(file)
@@ -71,13 +34,8 @@ app1 = gr.Interface(
71
  inputs=[gr.File(label="Загрузите файл Excel"), gr.Text(label="Введите дату (дд.мм.гггг):")],
72
  outputs=gr.Text(label="Результаты валют")
73
  )
74
- # Интерфейс для генерации графиков
75
- app2 = gr.Interface(
76
- fn=generate_plots,
77
- inputs=gr.File(label="Загрузите файл Excel"),
78
- outputs=gr.Image(type="filepath", label="Графики прогнозов"),
79
- )
80
 
81
  # Создание табов с интерфейсами
82
- demo = gr.TabbedInterface([app1, app2], ["Вывод цены за дату", "Предсказания на 6 месяцев"])
83
  demo.launch()
 
1
  from huggingface_hub import hf_hub_download
2
  import tensorflow as tf
3
  import numpy as np
 
4
  import gradio as gr
5
 
6
 
 
10
  # Загрузка модели
11
  model = tf.keras.models.load_model(model_path)
12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  def get_currency_values(file, date_input):
14
  # Чтение данных из Excel файла
15
  data = pd.read_excel(file)
 
34
  inputs=[gr.File(label="Загрузите файл Excel"), gr.Text(label="Введите дату (дд.мм.гггг):")],
35
  outputs=gr.Text(label="Результаты валют")
36
  )
37
+
 
 
 
 
 
38
 
39
  # Создание табов с интерфейсами
40
+ demo = gr.TabbedInterface([app1], ["Вывод цены за дату", "Предсказания на 6 месяцев"])
41
  demo.launch()
requirements.txt CHANGED
@@ -2,4 +2,3 @@ huggingface_hub
2
  tensorflow
3
  numpy
4
  gradio
5
- matplotlib.pyplot
 
2
  tensorflow
3
  numpy
4
  gradio