Spaces:
Sleeping
Sleeping
Updating UI strings and CSS
Browse files- ui/contentagentui.py +12 -16
ui/contentagentui.py
CHANGED
|
@@ -101,7 +101,11 @@ class ContentAgentUI:
|
|
| 101 |
if self.app is not None:
|
| 102 |
return self.app
|
| 103 |
|
| 104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
examples = self._load_examples()
|
| 106 |
|
| 107 |
with gr.Blocks(css=css) as demo:
|
|
@@ -118,16 +122,12 @@ class ContentAgentUI:
|
|
| 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 = "
|
| 130 |
-
strPlaceholder="
|
| 131 |
strSubmit = "Submit"
|
| 132 |
strOutput = "Content feedback"
|
| 133 |
|
|
@@ -137,18 +137,14 @@ class ContentAgentUI:
|
|
| 137 |
|
| 138 |
# Chat controls
|
| 139 |
self.agent_state = gr.State(None)
|
| 140 |
-
self.prompt = gr.Textbox(label=
|
| 141 |
-
self.reply = gr.Textbox(label=
|
| 142 |
-
submit_btn = gr.Button(
|
| 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")
|
|
|
|
| 101 |
if self.app is not None:
|
| 102 |
return self.app
|
| 103 |
|
| 104 |
+
# Optional: Adjust path if needed for hosted environments
|
| 105 |
+
css_path = os.path.join(os.getcwd(), "ui", "styles.css")
|
| 106 |
+
css = css_path if os.path.exists(css_path) else None
|
| 107 |
+
|
| 108 |
+
|
| 109 |
examples = self._load_examples()
|
| 110 |
|
| 111 |
with gr.Blocks(css=css) as demo:
|
|
|
|
| 122 |
)
|
| 123 |
start_btn = gr.Button("Start Agent (it can take up to 5 minute to start up)")
|
| 124 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
|
| 126 |
# Main panel (hidden until agent is initialized)
|
| 127 |
with gr.Group(visible=False) as self.main_panel:
|
| 128 |
+
# English only
|
| 129 |
+
strInput = "Content Input"
|
| 130 |
+
strPlaceholder="Copy and paste your content for evaluation here..."
|
| 131 |
strSubmit = "Submit"
|
| 132 |
strOutput = "Content feedback"
|
| 133 |
|
|
|
|
| 137 |
|
| 138 |
# Chat controls
|
| 139 |
self.agent_state = gr.State(None)
|
| 140 |
+
self.prompt = gr.Textbox(label=strInput, placeholder=strPlaceholder)
|
| 141 |
+
self.reply = gr.Textbox(label=strOutput, interactive=False, lines=12 max_lines=20)
|
| 142 |
+
submit_btn = gr.Button(strSubmit)
|
| 143 |
|
| 144 |
+
# Use bound methods to submit content
|
| 145 |
submit_btn.click(self._call_agent, inputs=[self.prompt, self.agent_state], outputs=self.reply)
|
| 146 |
self.prompt.submit(self._call_agent, inputs=[self.prompt, self.agent_state], outputs=self.reply)
|
| 147 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
|
| 149 |
# Examples (optional)
|
| 150 |
gr.Markdown("### Try one of these examples")
|