Spaces:
Running
on
L4
Running
on
L4
Update app.py
Browse files
app.py
CHANGED
@@ -118,36 +118,17 @@ def predict(content, policy):
|
|
118 |
else:
|
119 |
return f'NO MATCHES (i.e., non-violating)'
|
120 |
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
gr.Markdown("""
|
133 |
-
## About CoPE
|
134 |
-
|
135 |
-
CoPE (the COntent Policy Evaluation engine) is a small language model capable of accurate content policy labeling. This is a **demo* of our initial release and should **NOT** be used for any production use cases.
|
136 |
-
|
137 |
-
## How to Use
|
138 |
-
|
139 |
-
1. Enter your content in the "Content" box.
|
140 |
-
2. Specify your policy in the "Policy" box.
|
141 |
-
3. Click "Submit" to see the results.
|
142 |
-
|
143 |
-
## More Info
|
144 |
-
|
145 |
-
- [Give us feedback](https://forms.gle/BHpt6BpH2utaf4ez9) to help us improve
|
146 |
-
- [Read our FAQ](https://docs.google.com/document/d/1Cp3GJ5k2I-xWZ4GK9WI7Xv8TpKdHmjJ3E9RbzP5Cc_Y/edit) to learn more about CoPE
|
147 |
-
- [Join our mailing list](https://forms.gle/PCABrZdhTuXE9w9ZA) to keep in touch
|
148 |
-
""")
|
149 |
-
|
150 |
-
submit_btn.click(predict, inputs=[content_input, policy_input], outputs=output)
|
151 |
|
152 |
# Launch the app
|
153 |
iface.launch(show_api=False)
|
|
|
118 |
else:
|
119 |
return f'NO MATCHES (i.e., non-violating)'
|
120 |
|
121 |
+
|
122 |
+
# Create Gradio interface
|
123 |
+
iface = gr.Interface(
|
124 |
+
fn=predict,
|
125 |
+
inputs=[gr.Textbox(label="Content", lines=2, value=DEFAULT_CONTENT),
|
126 |
+
gr.Textbox(label="Policy", lines=8, value=DEFAULT_POLICY)],
|
127 |
+
outputs=[gr.Textbox(label="Result"),
|
128 |
+
gr.Markdown("TEST CONTENT")],
|
129 |
+
title="Zentropi CoPE Demo",
|
130 |
+
description="See if the given content violates your given policy."
|
131 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
|
133 |
# Launch the app
|
134 |
iface.launch(show_api=False)
|