Spaces:
Sleeping
Sleeping
fruitpicker01
commited on
Commit
•
2a47dfb
1
Parent(s):
ba48796
Update app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,6 @@ import gradio as gr
|
|
2 |
import pandas as pd
|
3 |
|
4 |
df = pd.read_excel('для Gradio финал.xlsx')
|
5 |
-
|
6 |
df['Регион'] = df['Регион'].fillna('').astype(str)
|
7 |
|
8 |
def format_output(data):
|
@@ -41,23 +40,24 @@ def filter_data(project_type, object_type, voltage, region):
|
|
41 |
else:
|
42 |
return message + format_output(national_data)
|
43 |
else:
|
44 |
-
|
45 |
-
return format_output(unique_regional_data)
|
46 |
except Exception as e:
|
47 |
return f"Ошибка: {str(e)}"
|
48 |
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
gr.
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
)
|
|
|
|
|
62 |
|
63 |
demo.launch()
|
|
|
2 |
import pandas as pd
|
3 |
|
4 |
df = pd.read_excel('для Gradio финал.xlsx')
|
|
|
5 |
df['Регион'] = df['Регион'].fillna('').astype(str)
|
6 |
|
7 |
def format_output(data):
|
|
|
40 |
else:
|
41 |
return message + format_output(national_data)
|
42 |
else:
|
43 |
+
return format_output(regional_data)
|
|
|
44 |
except Exception as e:
|
45 |
return f"Ошибка: {str(e)}"
|
46 |
|
47 |
+
with gr.Blocks() as demo:
|
48 |
+
gr.Markdown("# Подбор объектов-аналогов для прогнозирования недостающих технических характеристик")
|
49 |
+
gr.Markdown("## Введите параметры для поиска:")
|
50 |
+
with gr.Row():
|
51 |
+
with gr.Column():
|
52 |
+
gr.Markdown("### Исходные данные")
|
53 |
+
project_type = gr.Radio(choices=['Строительство', 'Реконструкция'], label="Тип проекта")
|
54 |
+
object_type = gr.Radio(choices=['ПС', 'ВЛ', 'КЛ'], label="Объект")
|
55 |
+
voltage = gr.Radio(choices=['6', '10', '35', '110', '220', '330', '400', '500', '750', '1150'], label="Напряжение, кВ")
|
56 |
+
region = gr.Dropdown(choices=sorted(df['Регион'].unique()), label="Регион")
|
57 |
+
submit_btn = gr.Button("Поиск")
|
58 |
+
with gr.Column():
|
59 |
+
gr.Markdown("### Результаты подбора объектов-аналогов")
|
60 |
+
output = gr.Markdown()
|
61 |
+
submit_btn.click(filter_data, inputs=[project_type, object_type, voltage, region], outputs=output)
|
62 |
|
63 |
demo.launch()
|