Spaces:
Sleeping
Sleeping
- .idea/.name +1 -0
- .idea/inspectionProfiles/profiles_settings.xml +6 -0
- .idea/vcs.xml +6 -0
- .idea/workspace.xml +12 -12
- app.py +8 -21
.idea/.name
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
app.py
|
.idea/inspectionProfiles/profiles_settings.xml
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<component name="InspectionProjectProfileManager">
|
2 |
+
<settings>
|
3 |
+
<option name="USE_PROJECT_PROFILE" value="false" />
|
4 |
+
<version value="1.0" />
|
5 |
+
</settings>
|
6 |
+
</component>
|
.idea/vcs.xml
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<project version="4">
|
3 |
+
<component name="VcsDirectoryMappings">
|
4 |
+
<mapping directory="" vcs="Git" />
|
5 |
+
</component>
|
6 |
+
</project>
|
.idea/workspace.xml
CHANGED
@@ -25,24 +25,24 @@
|
|
25 |
<component name="MarkdownSettingsMigration">
|
26 |
<option name="stateVersion" value="1" />
|
27 |
</component>
|
28 |
-
<component name="ProjectColorInfo"
|
29 |
-
|
30 |
-
}
|
31 |
<component name="ProjectId" id="2qa55E3JYXB02HCgldMr8OLkFmH" />
|
32 |
<component name="ProjectViewState">
|
33 |
<option name="hideEmptyMiddlePackages" value="true" />
|
34 |
<option name="showLibraryContents" value="true" />
|
35 |
</component>
|
36 |
-
<component name="PropertiesComponent"
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
}
|
45 |
-
}
|
46 |
<component name="RunManager">
|
47 |
<configuration name="app" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
|
48 |
<module name="money" />
|
|
|
25 |
<component name="MarkdownSettingsMigration">
|
26 |
<option name="stateVersion" value="1" />
|
27 |
</component>
|
28 |
+
<component name="ProjectColorInfo">{
|
29 |
+
"associatedIndex": 2
|
30 |
+
}</component>
|
31 |
<component name="ProjectId" id="2qa55E3JYXB02HCgldMr8OLkFmH" />
|
32 |
<component name="ProjectViewState">
|
33 |
<option name="hideEmptyMiddlePackages" value="true" />
|
34 |
<option name="showLibraryContents" value="true" />
|
35 |
</component>
|
36 |
+
<component name="PropertiesComponent">{
|
37 |
+
"keyToString": {
|
38 |
+
"ASKED_ADD_EXTERNAL_FILES": "true",
|
39 |
+
"ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
40 |
+
"Python.app.executor": "Run",
|
41 |
+
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
42 |
+
"RunOnceActivity.ShowReadmeOnStart": "true",
|
43 |
+
"git-widget-placeholder": "main"
|
44 |
}
|
45 |
+
}</component>
|
46 |
<component name="RunManager">
|
47 |
<configuration name="app" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
|
48 |
<module name="money" />
|
app.py
CHANGED
@@ -5,37 +5,24 @@ import gradio as gr
|
|
5 |
|
6 |
|
7 |
# Загрузка файла модели из Hugging Face Hub
|
8 |
-
model_path = hf_hub_download(repo_id="neuronetties/money", filename="
|
9 |
|
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)
|
16 |
-
data.dropna(inplace=True)
|
17 |
-
|
18 |
-
# Преобразование столбца даты в формат datetime
|
19 |
-
data['Date'] = pd.to_datetime(data['Date'], dayfirst=True) # Убедитесь, что у вас есть столбец 'Date'
|
20 |
-
|
21 |
-
# Поиск значений валют по введенной дате
|
22 |
-
date = pd.to_datetime(date_input, dayfirst=True)
|
23 |
-
row = data[data['Date'] == date]
|
24 |
-
|
25 |
-
if not row.empty:
|
26 |
-
values = row[['EUR_RUB', 'GBP_RUB', 'USD_RUB']].values.flatten()
|
27 |
-
return f"На {date_input}: USD/RUB: {values[2]}, EUR/RUB: {values[0]}, GBP/RUB: {values[1]}"
|
28 |
-
else:
|
29 |
-
return f"Данные на {date_input} не найдены."
|
30 |
-
|
31 |
# Интерфейс для получения значений валют
|
32 |
app1 = gr.Interface(
|
33 |
fn=get_currency_values,
|
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()
|
|
|
5 |
|
6 |
|
7 |
# Загрузка файла модели из Hugging Face Hub
|
8 |
+
model_path = hf_hub_download(repo_id="neuronetties/money", filename="money2.keras")
|
9 |
|
10 |
# Загрузка модели
|
11 |
model = tf.keras.models.load_model(model_path)
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
# Интерфейс для получения значений валют
|
14 |
app1 = gr.Interface(
|
15 |
fn=get_currency_values,
|
16 |
inputs=[gr.File(label="Загрузите файл Excel"), gr.Text(label="Введите дату (дд.мм.гггг):")],
|
17 |
outputs=gr.Text(label="Результаты валют")
|
18 |
)
|
19 |
+
# Интерфейс для генерации графиков
|
20 |
+
app2 = gr.Interface(
|
21 |
+
fn=generate_plots,
|
22 |
+
inputs=gr.File(label="Загрузите файл Excel"),
|
23 |
+
outputs=gr.Image(type="filepath", label="Графики прогнозов"),
|
24 |
+
)
|
25 |
|
26 |
# Создание табов с интерфейсами
|
27 |
+
demo = gr.TabbedInterface([app1, app2], ["Вывод цены за дату", "Предсказания на 6 месяцев"])
|
28 |
demo.launch()
|