Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -14,7 +14,6 @@ TRUSTED_UPLOADERS = ["KappaNeuro", "CiroN2022", "multimodalart", "Norod78", "joa
|
|
14 |
|
15 |
def get_json_data(url):
|
16 |
url_split = url.split('/')
|
17 |
-
print("url_split: ", url_split)
|
18 |
api_url = f"https://civitai.com/api/v1/models/{url_split[4]}"
|
19 |
try:
|
20 |
response = requests.get(api_url)
|
@@ -37,12 +36,10 @@ def check_nsfw(json_data, profile):
|
|
37 |
return True
|
38 |
|
39 |
def get_prompts_from_image(image_id):
|
40 |
-
print("image_id: ", image_id)
|
41 |
url = f'https://civitai.com/images/{image_id}'
|
42 |
response = requests.get(url)
|
43 |
soup = BeautifulSoup(response.text, 'html.parser')
|
44 |
content = soup.find_all(class_='mantine-Code-root mantine-Code-block mantine-2v44jn')
|
45 |
-
print(content)
|
46 |
if(content):
|
47 |
if(len(content) > 1):
|
48 |
return content[0].text, content[1].text
|
@@ -246,7 +243,6 @@ For more details, including weighting, merging and fusing LoRAs, check the [docu
|
|
246 |
# elif index > 1:
|
247 |
# content += f"\n\n> {prompt}\n"
|
248 |
readme_content += content + "\n"
|
249 |
-
print(readme_content)
|
250 |
with open(f"{folder}/README.md", "w") as file:
|
251 |
file.write(readme_content)
|
252 |
|
@@ -368,7 +364,7 @@ def bulk_upload(profile: Optional[gr.OAuthProfile], oauth_token: gr.OAuthToken,
|
|
368 |
if(url):
|
369 |
try:
|
370 |
upload_result = upload_civit_to_hf(profile, oauth_token, url, link_civit)
|
371 |
-
gr.
|
372 |
yield upload_result
|
373 |
except Exception as e:
|
374 |
print(e)
|
|
|
14 |
|
15 |
def get_json_data(url):
|
16 |
url_split = url.split('/')
|
|
|
17 |
api_url = f"https://civitai.com/api/v1/models/{url_split[4]}"
|
18 |
try:
|
19 |
response = requests.get(api_url)
|
|
|
36 |
return True
|
37 |
|
38 |
def get_prompts_from_image(image_id):
|
|
|
39 |
url = f'https://civitai.com/images/{image_id}'
|
40 |
response = requests.get(url)
|
41 |
soup = BeautifulSoup(response.text, 'html.parser')
|
42 |
content = soup.find_all(class_='mantine-Code-root mantine-Code-block mantine-2v44jn')
|
|
|
43 |
if(content):
|
44 |
if(len(content) > 1):
|
45 |
return content[0].text, content[1].text
|
|
|
243 |
# elif index > 1:
|
244 |
# content += f"\n\n> {prompt}\n"
|
245 |
readme_content += content + "\n"
|
|
|
246 |
with open(f"{folder}/README.md", "w") as file:
|
247 |
file.write(readme_content)
|
248 |
|
|
|
364 |
if(url):
|
365 |
try:
|
366 |
upload_result = upload_civit_to_hf(profile, oauth_token, url, link_civit)
|
367 |
+
gr.Info(f"Model {link_civit} uploaded")
|
368 |
yield upload_result
|
369 |
except Exception as e:
|
370 |
print(e)
|