M17idd commited on
Commit
f3eb11e
·
verified ·
1 Parent(s): 6ca758a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +49 -8
app.py CHANGED
@@ -52,19 +52,60 @@ def generate_report(operation_data, max_tokens, temperature, top_p):
52
  response = llm(messages)
53
  return response.content
54
 
55
- # رابط Gradio
56
  demo = gr.Interface(
57
  fn=generate_report,
58
  inputs=[
59
- gr.Textbox(label="اطلاعات عملیات نظامی", lines=10, placeholder="مثلاً: در ساعت ۵ صبح، گردان الف از محور غربی وارد منطقه شد..."),
60
- gr.Slider(128, 2048, value=1024, step=64, label="حداکثر توکن خروجی"),
61
- gr.Slider(0.1, 1.5, value=0.7, step=0.1, label="دمای خلاقیت (temperature)"),
62
- gr.Slider(0.1, 1.0, value=0.95, step=0.05, label="Top-p"),
 
 
 
 
 
63
  ],
64
- outputs=gr.Textbox(label="گزارش رسمی تولید شده", lines=10),
65
- title="گزارش‌نویس هوش مصنوعی عملیات نظامی",
66
- description="اطلاعات خام عملیات نظامی را وارد کن تا گزارش رسمی، خلاصه و حرفه‌ای تولید شود."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  )
68
 
 
 
69
  if __name__ == "__main__":
70
  demo.launch()
 
52
  response = llm(messages)
53
  return response.content
54
 
 
55
  demo = gr.Interface(
56
  fn=generate_report,
57
  inputs=[
58
+ gr.Textbox(
59
+ label="🪖 اطلاعات عملیات نظامی",
60
+ lines=10,
61
+ placeholder="مثلاً: در ساعت ۵ صبح، گردان الف از محور غربی وارد منطقه شد...",
62
+ elem_id="military-input"
63
+ ),
64
+ gr.Slider(128, 2048, value=1024, step=64, label="🎯 حداکثر توکن خروجی"),
65
+ gr.Slider(0.1, 1.5, value=0.7, step=0.1, label="🔥 دمای خلاقیت (temperature)"),
66
+ gr.Slider(0.1, 1.0, value=0.95, step=0.05, label="🎯 Top-p"),
67
  ],
68
+ outputs=gr.Textbox(label="📄 گزارش رسمی تولید شده", lines=10, elem_id="military-output"),
69
+ title="🛰️ سامانه گزارش‌ساز هوش مصنوعی «توانا»",
70
+ description="🔰 اطلاعات خام عملیات را وارد کن تا سامانه توانا یک گزارش رسمی، حرفه‌ای و محرمانه تولید کند.",
71
+ theme="default",
72
+ css="""
73
+ body {
74
+ background-color: #1b1f1d !important;
75
+ color: #d6d6d6 !important;
76
+ font-family: 'Vazir', sans-serif;
77
+ direction: rtl;
78
+ }
79
+
80
+ .gradio-container {
81
+ background-color: #1b1f1d !important;
82
+ }
83
+
84
+ label {
85
+ font-size: 18px !important;
86
+ color: #a2ff94 !important; /* سبز نظامی */
87
+ font-weight: bold;
88
+ }
89
+
90
+ #military-input textarea, #military-output textarea {
91
+ background-color: #2a2d2b !important;
92
+ color: #ffffff !important;
93
+ border: 1px solid #4e5d52 !important;
94
+ }
95
+
96
+ .gr-button {
97
+ background-color: #3b593b !important;
98
+ color: white !important;
99
+ border-radius: 8px;
100
+ }
101
+
102
+ .gr-button:hover {
103
+ background-color: #4e754e !important;
104
+ }
105
+ """
106
  )
107
 
108
+ demo.launch()
109
+
110
  if __name__ == "__main__":
111
  demo.launch()