lg3394 commited on
Commit
716822e
·
verified ·
1 Parent(s): cb839c5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -1,8 +1,8 @@
1
  import gradio as gr
2
  from openai import OpenAI
3
 
4
- # Initialize OpenAI moderation client
5
- client = OpenAI()
6
 
7
  def moderate_text(text):
8
  response = client.moderations.create(
@@ -18,4 +18,4 @@ def moderate_text(text):
18
  return "The text is not flagged for any moderation issues."
19
 
20
  iface = gr.Interface(fn=moderate_text, inputs="text", outputs="text")
21
- iface.launch()
 
1
  import gradio as gr
2
  from openai import OpenAI
3
 
4
+ # Initialize OpenAI moderation client with your API key
5
+ client = OpenAI(api_key="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")
6
 
7
  def moderate_text(text):
8
  response = client.moderations.create(
 
18
  return "The text is not flagged for any moderation issues."
19
 
20
  iface = gr.Interface(fn=moderate_text, inputs="text", outputs="text")
21
+ iface.launch()