samidh commited on
Commit
a599a25
·
verified ·
1 Parent(s): 88711eb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -30
app.py CHANGED
@@ -118,36 +118,17 @@ def predict(content, policy):
118
  else:
119
  return f'NO MATCHES (i.e., non-violating)'
120
 
121
- with gr.Blocks() as iface:
122
- gr.Markdown("# Zentropi CoPE Demo")
123
- gr.Markdown("See if the given content matches any of your given policy labels.")
124
-
125
- with gr.Row():
126
- content_input = gr.Textbox(label="Content (English Only)", lines=2, value=DEFAULT_CONTENT)
127
- policy_input = gr.Textbox(label="Policy (Write Your Own)", lines=10, value=DEFAULT_POLICY)
128
-
129
- submit_btn = gr.Button("Submit")
130
- output = gr.Label(label="Label")
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)