Update app.py
Browse files
app.py
CHANGED
@@ -40,14 +40,8 @@ def generate_report(operation_data, max_tokens, temperature, top_p):
|
|
40 |
✅ این گزارش بر اساس اطلاعات خام ارائهشده تولید شده و ممکن است برخی جزئیات در دسترس نبوده باشند.
|
41 |
"""
|
42 |
|
43 |
-
messages = [
|
44 |
-
HumanMessage(content=f"{system_prompt}\n\n{operation_data}")
|
45 |
-
]
|
46 |
-
|
47 |
response = llm(messages)
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
return response.content
|
52 |
|
53 |
demo = gr.Interface(
|
@@ -64,74 +58,77 @@ demo = gr.Interface(
|
|
64 |
gr.Slider(0.1, 1.0, value=0.95, step=0.05, label="🎯 Top-p", elem_id="slider-3"),
|
65 |
],
|
66 |
outputs=[
|
67 |
-
gr.Textbox(label="📄 گزارش رسمی تولید شده", lines=
|
68 |
],
|
69 |
-
title="🛰️ سامانه گزارشساز رزم
|
70 |
-
description="🔰 اطلاعات
|
71 |
css="""
|
72 |
body {
|
73 |
-
background-color: #d9dec5 !important;
|
74 |
-
color: #1e293b !important;
|
75 |
font-family: 'Vazir', sans-serif;
|
76 |
direction: rtl;
|
77 |
}
|
|
|
78 |
.gradio-container {
|
79 |
background-color: #d9dec5 !important;
|
|
|
80 |
}
|
|
|
81 |
label {
|
82 |
font-size: 22px !important;
|
83 |
-
color: #
|
84 |
font-weight: bold;
|
|
|
85 |
}
|
|
|
86 |
#military-input textarea, #military-output textarea {
|
87 |
-
background-color: #
|
88 |
color: #1e293b !important;
|
89 |
-
border: 2px solid #529b39 !important;
|
|
|
|
|
|
|
|
|
90 |
}
|
|
|
91 |
.gr-button {
|
92 |
-
background-color: #529b39 !important;
|
93 |
color: #eeeeee !important;
|
94 |
border-radius: 12px;
|
95 |
font-size: 18px;
|
96 |
padding: 14px;
|
97 |
transition: all 0.3s ease;
|
98 |
}
|
|
|
99 |
.gr-button:hover {
|
100 |
-
background-color: #45a12d !important;
|
101 |
transform: scale(1.05);
|
102 |
}
|
|
|
103 |
.gr-button:active {
|
104 |
-
background-color: #3b8e27 !important;
|
105 |
}
|
|
|
106 |
.gr-button[type="submit"] {
|
107 |
-
background-color: #529b39 !important;
|
108 |
}
|
|
|
109 |
.gr-button[type="reset"] {
|
110 |
-
background-color: #ff7043 !important;
|
111 |
}
|
|
|
112 |
.gradio-footer {
|
113 |
display: none !important;
|
114 |
}
|
115 |
-
|
116 |
.gr-textbox input[type="text"], .gr-textbox textarea {
|
117 |
-
|
118 |
-
color: #eeeeee !important;
|
119 |
-
border: 2px solid #529b39 !important;
|
120 |
-
font-size: 16px;
|
121 |
-
direction: rtl; /* افزودن جهت راست به چپ */
|
122 |
-
text-align: right; /* تنظیم ترازبندی متن به راست */
|
123 |
-
}
|
124 |
-
|
125 |
-
.gr-textbox input[type="text"]:focus, .gr-textbox textarea:focus {
|
126 |
-
border-color: #FF6F00 !important;
|
127 |
-
outline: none;
|
128 |
}
|
129 |
""",
|
130 |
submit_btn="🎯 تولید گزارش",
|
131 |
clear_btn="🗑️ پاک کردن"
|
132 |
)
|
133 |
|
134 |
-
demo.launch()
|
135 |
-
|
136 |
if __name__ == "__main__":
|
137 |
-
demo.launch()
|
|
|
40 |
✅ این گزارش بر اساس اطلاعات خام ارائهشده تولید شده و ممکن است برخی جزئیات در دسترس نبوده باشند.
|
41 |
"""
|
42 |
|
43 |
+
messages = [HumanMessage(content=f"{system_prompt}\n\n{operation_data}")]
|
|
|
|
|
|
|
44 |
response = llm(messages)
|
|
|
|
|
|
|
45 |
return response.content
|
46 |
|
47 |
demo = gr.Interface(
|
|
|
58 |
gr.Slider(0.1, 1.0, value=0.95, step=0.05, label="🎯 Top-p", elem_id="slider-3"),
|
59 |
],
|
60 |
outputs=[
|
61 |
+
gr.Textbox(label="📄 گزارش رسمی تولید شده", lines=15, elem_id="military-output")
|
62 |
],
|
63 |
+
title="🛰️ سامانه گزارشساز رزم یار",
|
64 |
+
description="🔰 اطلاعات عملیات را وارد کنید تا سامانه یک گزارش رسمی تولید کند.",
|
65 |
css="""
|
66 |
body {
|
67 |
+
background-color: #d9dec5 !important;
|
68 |
+
color: #1e293b !important;
|
69 |
font-family: 'Vazir', sans-serif;
|
70 |
direction: rtl;
|
71 |
}
|
72 |
+
|
73 |
.gradio-container {
|
74 |
background-color: #d9dec5 !important;
|
75 |
+
direction: rtl;
|
76 |
}
|
77 |
+
|
78 |
label {
|
79 |
font-size: 22px !important;
|
80 |
+
color: #1e293b !important;
|
81 |
font-weight: bold;
|
82 |
+
text-align: right;
|
83 |
}
|
84 |
+
|
85 |
#military-input textarea, #military-output textarea {
|
86 |
+
background-color: #f0f4e5 !important;
|
87 |
color: #1e293b !important;
|
88 |
+
border: 2px solid #529b39 !important;
|
89 |
+
direction: rtl !important;
|
90 |
+
text-align: right !important;
|
91 |
+
font-size: 16px;
|
92 |
+
line-height: 1.8;
|
93 |
}
|
94 |
+
|
95 |
.gr-button {
|
96 |
+
background-color: #529b39 !important;
|
97 |
color: #eeeeee !important;
|
98 |
border-radius: 12px;
|
99 |
font-size: 18px;
|
100 |
padding: 14px;
|
101 |
transition: all 0.3s ease;
|
102 |
}
|
103 |
+
|
104 |
.gr-button:hover {
|
105 |
+
background-color: #45a12d !important;
|
106 |
transform: scale(1.05);
|
107 |
}
|
108 |
+
|
109 |
.gr-button:active {
|
110 |
+
background-color: #3b8e27 !important;
|
111 |
}
|
112 |
+
|
113 |
.gr-button[type="submit"] {
|
114 |
+
background-color: #529b39 !important;
|
115 |
}
|
116 |
+
|
117 |
.gr-button[type="reset"] {
|
118 |
+
background-color: #ff7043 !important;
|
119 |
}
|
120 |
+
|
121 |
.gradio-footer {
|
122 |
display: none !important;
|
123 |
}
|
124 |
+
|
125 |
.gr-textbox input[type="text"], .gr-textbox textarea {
|
126 |
+
font-family: 'Vazir', sans-serif;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
}
|
128 |
""",
|
129 |
submit_btn="🎯 تولید گزارش",
|
130 |
clear_btn="🗑️ پاک کردن"
|
131 |
)
|
132 |
|
|
|
|
|
133 |
if __name__ == "__main__":
|
134 |
+
demo.launch()
|