sdafd commited on
Commit
8c9c7bb
·
verified ·
1 Parent(s): 4482733

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -37,7 +37,7 @@ def check_nsfw(img_url):
37
  for content in r.iter_content(100):
38
  # Decode the byte content to a string
39
  buffer += content.decode('utf-8')
40
-
41
  return json.loads(buffer.split('data:')[len(buffer.split('data:'))-2])["output"]["data"][0]['label']
42
 
43
 
@@ -60,6 +60,8 @@ def check_nsfw2(img_url):
60
  for content in r.iter_content(100):
61
  # Decode the byte content to a string
62
  buffer += content.decode('utf-8')
 
 
63
  return json.loads(buffer.split('data:')[len(buffer.split('data:'))-2])["output"]["data"][0]['label']
64
 
65
  def check_nsfw3(img_url):
@@ -76,6 +78,9 @@ def check_nsfw3(img_url):
76
  event_stream = ''
77
  for chunk in r.iter_content(100):
78
  event_stream += chunk.decode('utf-8')
 
 
 
79
  return ast.literal_eval(event_stream.split('data:')[-1])[0]['label']
80
 
81
  def get_replica_code(url):
@@ -105,6 +110,8 @@ def check_nsfw4(img_url):
105
  for content in r.iter_content(100):
106
  # Decode the byte content to a string
107
  buffer += content.decode('utf-8')
 
 
108
  return json.loads(buffer.split('data:')[-1])["output"]["data"][0]['label']
109
 
110
  def check_nsfw5(img_url):
@@ -126,6 +133,8 @@ def check_nsfw5(img_url):
126
  for content in r.iter_content(100):
127
  # Decode the byte content to a string
128
  buffer += content.decode('utf-8')
 
 
129
  return json.loads(buffer.split('data:')[-1])["output"]["data"][0]['label']
130
 
131
  def check_nsfw_final(img_url):
 
37
  for content in r.iter_content(100):
38
  # Decode the byte content to a string
39
  buffer += content.decode('utf-8')
40
+ print(buffer)
41
  return json.loads(buffer.split('data:')[len(buffer.split('data:'))-2])["output"]["data"][0]['label']
42
 
43
 
 
60
  for content in r.iter_content(100):
61
  # Decode the byte content to a string
62
  buffer += content.decode('utf-8')
63
+
64
+ print(buffer)
65
  return json.loads(buffer.split('data:')[len(buffer.split('data:'))-2])["output"]["data"][0]['label']
66
 
67
  def check_nsfw3(img_url):
 
78
  event_stream = ''
79
  for chunk in r.iter_content(100):
80
  event_stream += chunk.decode('utf-8')
81
+
82
+ print(event_stream)
83
+
84
  return ast.literal_eval(event_stream.split('data:')[-1])[0]['label']
85
 
86
  def get_replica_code(url):
 
110
  for content in r.iter_content(100):
111
  # Decode the byte content to a string
112
  buffer += content.decode('utf-8')
113
+
114
+ print(buffer)
115
  return json.loads(buffer.split('data:')[-1])["output"]["data"][0]['label']
116
 
117
  def check_nsfw5(img_url):
 
133
  for content in r.iter_content(100):
134
  # Decode the byte content to a string
135
  buffer += content.decode('utf-8')
136
+
137
+ print(buffer)
138
  return json.loads(buffer.split('data:')[-1])["output"]["data"][0]['label']
139
 
140
  def check_nsfw_final(img_url):