Spaces:
Running
Running
Commit
•
5155223
1
Parent(s):
e460389
Update app.py
Browse files
app.py
CHANGED
@@ -35,26 +35,8 @@ def check_nsfw(json_data, profile):
|
|
35 |
return False
|
36 |
return True
|
37 |
|
38 |
-
def get_prompts_from_image(image_id):
|
39 |
-
headers = {
|
40 |
-
"authority": "civitai.com",
|
41 |
-
"accept": "*/*",
|
42 |
-
"accept-language": "en-BR,en;q=0.9,pt-BR;q=0.8,pt;q=0.7,es-ES;q=0.6,es;q=0.5,de-LI;q=0.4,de;q=0.3,en-GB;q=0.2,en-US;q=0.1,sk;q=0.1",
|
43 |
-
"content-type": "application/json",
|
44 |
-
"cookie": f'{os.environ["COOKIE_INFO"]}',
|
45 |
-
"if-modified-since": "Tue, 22 Aug 2023 07:18:52 GMT",
|
46 |
-
"referer": f"https://civitai.com/user/{username}/models",
|
47 |
-
"sec-ch-ua": "\"Not.A/Brand\";v=\"8\", \"Chromium\";v=\"114\", \"Google Chrome\";v=\"114\"",
|
48 |
-
"sec-ch-ua-mobile": "?0",
|
49 |
-
"sec-ch-ua-platform": "macOS",
|
50 |
-
"sec-fetch-dest": "empty",
|
51 |
-
"sec-fetch-mode": "cors",
|
52 |
-
"sec-fetch-site": "same-origin",
|
53 |
-
"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
|
54 |
-
}
|
55 |
url = f'https://civitai.com/api/trpc/image.getGenerationData?input={{"json":{{"id":{image_id}}}}}'
|
56 |
-
response = requests.get(url, headers=headers)
|
57 |
-
url = f'https://civitai.com/images/{image_id}'
|
58 |
response = requests.get(url)
|
59 |
prompt = ""
|
60 |
negative_prompt = ""
|
|
|
35 |
return False
|
36 |
return True
|
37 |
|
38 |
+
def get_prompts_from_image(image_id, username):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
url = f'https://civitai.com/api/trpc/image.getGenerationData?input={{"json":{{"id":{image_id}}}}}'
|
|
|
|
|
40 |
response = requests.get(url)
|
41 |
prompt = ""
|
42 |
negative_prompt = ""
|