yetessam commited on
Commit
6e8313e
·
verified ·
1 Parent(s): 7c60db6

Update ui/contentagentui.py

Browse files
Files changed (1) hide show
  1. ui/contentagentui.py +40 -10
ui/contentagentui.py CHANGED
@@ -32,6 +32,25 @@ class ContentAgentUI:
32
 
33
  # ---------- helpers ----------
34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  def _read_css(self) -> str | None:
36
  css_path = os.path.join(os.getcwd(), "ui", "styles.css")
37
  if os.path.exists(css_path):
@@ -99,27 +118,38 @@ class ContentAgentUI:
99
  )
100
  start_btn = gr.Button("Start Agent (it can take up to 5 minute to start up)")
101
 
 
 
 
 
 
102
  # Main panel (hidden until agent is initialized)
103
  with gr.Group(visible=False) as self.main_panel:
104
- # Guidance / about
105
- gr.Markdown(
106
- "### What this does\n"
107
- "Enter text below; the agent will classify tone (polite/neutral/impolite) and can use tools.\n\n"
108
- "**Tech:**\n"
109
- "- `deepseek-ai/DeepSeek-R1-Distill-Qwen-32B` (endpoint)\n"
110
- "- Intel Polite Guard tool\n"
111
- "- Runs via your Inference Endpoint\n"
112
- )
113
 
 
 
 
 
 
 
 
 
 
114
  # Chat controls
115
  self.agent_state = gr.State(None)
116
  self.prompt = gr.Textbox(label="Content Input", placeholder="Enter your content for evaluation here.")
117
- self.reply = gr.Textbox(label="Content feedback", interactive=False, lines=12)
118
  submit_btn = gr.Button("Submit")
119
 
120
  submit_btn.click(self._call_agent, inputs=[self.prompt, self.agent_state], outputs=self.reply)
121
  self.prompt.submit(self._call_agent, inputs=[self.prompt, self.agent_state], outputs=self.reply)
122
 
 
 
 
 
 
 
123
  # Examples (optional)
124
  gr.Markdown("### Try one of these examples")
125
  if examples:
 
32
 
33
  # ---------- helpers ----------
34
 
35
+
36
+ def _create_user_guidance(self):
37
+ gr.Markdown("""
38
+ Please enter text below to get started. Content Agent will try to determine whether the language is polite and uses the following classification:
39
+ - `polite`
40
+ - `somewhat polite`
41
+ - `neutral`
42
+ - `impolite`
43
+ Technology:
44
+ - App is running `deepseek-ai/DeepSeek-R1-Distill-Qwen-32B` text generation model.
45
+ - Agent uses Intel's Polite Guard NLP library tool
46
+ - Compute on GCP · Nvidia L4 · 4x GPUs · 96 GB
47
+ - By design, the inference endpoint is designed to fall asleep to save electricity and $$. If you were to run Content Agent for your business, you would configure it to run 24 hr/day, 7 days/week
48
+
49
+ """)
50
+
51
+
52
+
53
+
54
  def _read_css(self) -> str | None:
55
  css_path = os.path.join(os.getcwd(), "ui", "styles.css")
56
  if os.path.exists(css_path):
 
118
  )
119
  start_btn = gr.Button("Start Agent (it can take up to 5 minute to start up)")
120
 
121
+
122
+
123
+
124
+
125
+
126
  # Main panel (hidden until agent is initialized)
127
  with gr.Group(visible=False) as self.main_panel:
 
 
 
 
 
 
 
 
 
128
 
129
+ strInput = "Your Input"
130
+ strPlaceholder="Enter something here...")
131
+ strSubmit = "Submit"
132
+ strOutput = "Content feedback"
133
+
134
+
135
+ # Guidance / about
136
+ self._create_user_guidance()
137
+
138
  # Chat controls
139
  self.agent_state = gr.State(None)
140
  self.prompt = gr.Textbox(label="Content Input", placeholder="Enter your content for evaluation here.")
141
+ self.reply = gr.Textbox(label="Content feedback", interactive=False, lines=12 max_lines=20)
142
  submit_btn = gr.Button("Submit")
143
 
144
  submit_btn.click(self._call_agent, inputs=[self.prompt, self.agent_state], outputs=self.reply)
145
  self.prompt.submit(self._call_agent, inputs=[self.prompt, self.agent_state], outputs=self.reply)
146
 
147
+
148
+ # Use bound method with `self`
149
+ #self.submit_button.click(self.call_agent, inputs=self.user_input, outputs=self.output)
150
+ #self.user_input.submit(self.call_agent, inputs=self.user_input, outputs=self.output)
151
+
152
+
153
  # Examples (optional)
154
  gr.Markdown("### Try one of these examples")
155
  if examples: