Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -81,44 +81,27 @@ def get_facts(user_question: str) -> str:
|
|
| 81 |
response = Settings.llm.chat(messages)
|
| 82 |
return response.message.content
|
| 83 |
|
| 84 |
-
with gr.Blocks(theme=gr.themes.Soft()
|
| 85 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
user_input = gr.Textbox(
|
| 87 |
label="Ваш запрос",
|
| 88 |
lines=5,
|
| 89 |
-
max_lines=5,
|
| 90 |
placeholder="Введите свой запрос..."
|
| 91 |
)
|
| 92 |
|
| 93 |
-
answer_output = gr.HTML(
|
| 94 |
-
|
| 95 |
-
elem_classes="large-output"
|
| 96 |
-
)
|
| 97 |
send_button = gr.Button("Получить ответ")
|
| 98 |
-
|
| 99 |
send_button.click(fn=get_facts, inputs=user_input, outputs=answer_output)
|
| 100 |
|
| 101 |
-
# кастомный CSS
|
| 102 |
-
demo.load(
|
| 103 |
-
None,
|
| 104 |
-
None,
|
| 105 |
-
None,
|
| 106 |
-
_js="""
|
| 107 |
-
() => {
|
| 108 |
-
const style = document.createElement('style');
|
| 109 |
-
style.innerHTML = `
|
| 110 |
-
.large-output {
|
| 111 |
-
min-height: 400px !important;
|
| 112 |
-
height: auto !important;
|
| 113 |
-
overflow-y: auto;
|
| 114 |
-
border: 1px solid #ccc;
|
| 115 |
-
padding: 10px;
|
| 116 |
-
border-radius: 8px;
|
| 117 |
-
}
|
| 118 |
-
`;
|
| 119 |
-
document.head.appendChild(style);
|
| 120 |
-
}
|
| 121 |
-
"""
|
| 122 |
-
)
|
| 123 |
-
|
| 124 |
demo.launch()
|
|
|
|
| 81 |
response = Settings.llm.chat(messages)
|
| 82 |
return response.message.content
|
| 83 |
|
| 84 |
+
with gr.Blocks(theme=gr.themes.Soft(), css="""
|
| 85 |
+
.large-output {
|
| 86 |
+
min-height: 400px;
|
| 87 |
+
height: auto;
|
| 88 |
+
overflow-y: auto;
|
| 89 |
+
border: 1px solid #ccc;
|
| 90 |
+
padding: 10px;
|
| 91 |
+
border-radius: 8px;
|
| 92 |
+
}
|
| 93 |
+
""") as demo:
|
| 94 |
+
gr.Markdown("#Информационная система для помощи в адаптации к климатическим рискам")
|
| 95 |
+
|
| 96 |
user_input = gr.Textbox(
|
| 97 |
label="Ваш запрос",
|
| 98 |
lines=5,
|
|
|
|
| 99 |
placeholder="Введите свой запрос..."
|
| 100 |
)
|
| 101 |
|
| 102 |
+
answer_output = gr.HTML(label="Рекомендованные адаптационные мероприятия", elem_classes="large-output")
|
| 103 |
+
|
|
|
|
|
|
|
| 104 |
send_button = gr.Button("Получить ответ")
|
|
|
|
| 105 |
send_button.click(fn=get_facts, inputs=user_input, outputs=answer_output)
|
| 106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
demo.launch()
|