Spaces:
Runtime error
Runtime error
measmonysuon
commited on
Commit
•
cf2dec3
1
Parent(s):
69d03a0
Update app.py
Browse files
app.py
CHANGED
@@ -5,6 +5,13 @@ import logging
|
|
5 |
import requests
|
6 |
|
7 |
webhook_server = os.getenv('webhook_server')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
# Initialize the client for image generation "prithivMLmods/IMAGINEO-4K" "mukaist/DALLE-4K"
|
10 |
client_image = Client("measmonysuon/DALLE-4K")
|
@@ -27,7 +34,10 @@ def generate_image(prompt, resolution_key, style=DEFAULT_STYLE):
|
|
27 |
full_prompt = f"{prompt}, Canon EOS R5, 4K, Photo-Realistic, appearing photorealistic with super fine details, high resolution, natural look, hyper realistic photography, cinematic lighting, --ar 64:37, --v 6.0, --style raw, --stylize 750"
|
28 |
|
29 |
try:
|
30 |
-
|
|
|
|
|
|
|
31 |
prompt=full_prompt,
|
32 |
negative_prompt="(deformed, distorted, disfigured:1.3), poorly drawn, bad anatomy, wrong anatomy, extra limb, missing limb, floating limbs, (mutated hands and fingers:1.4), disconnected limbs, mutation, mutated, ugly, disgusting, blurry, amputation",
|
33 |
use_negative_prompt=True,
|
@@ -36,13 +46,15 @@ def generate_image(prompt, resolution_key, style=DEFAULT_STYLE):
|
|
36 |
width=width,
|
37 |
height=height,
|
38 |
guidance_scale=5,
|
39 |
-
randomize_seed=True
|
40 |
-
|
41 |
)
|
42 |
logger.info("Image generation successful.")
|
|
|
|
|
43 |
return result
|
44 |
-
except
|
45 |
-
|
46 |
return None
|
47 |
|
48 |
def request_otp(user_chat_id):
|
|
|
5 |
import requests
|
6 |
|
7 |
webhook_server = os.getenv('webhook_server')
|
8 |
+
ZeroGPU = os.getenv('ZeroGPU')
|
9 |
+
BASE_URL = os.getenv('SpaceURL')
|
10 |
+
|
11 |
+
# Define your headers including the Authorization with your token
|
12 |
+
headers = {
|
13 |
+
"Authorization": f"Bearer {API_TOKEN}"
|
14 |
+
}
|
15 |
|
16 |
# Initialize the client for image generation "prithivMLmods/IMAGINEO-4K" "mukaist/DALLE-4K"
|
17 |
client_image = Client("measmonysuon/DALLE-4K")
|
|
|
34 |
full_prompt = f"{prompt}, Canon EOS R5, 4K, Photo-Realistic, appearing photorealistic with super fine details, high resolution, natural look, hyper realistic photography, cinematic lighting, --ar 64:37, --v 6.0, --style raw, --stylize 750"
|
35 |
|
36 |
try:
|
37 |
+
response = requests.post(
|
38 |
+
f"{BASE_URL}/run",
|
39 |
+
headers=headers,
|
40 |
+
json={
|
41 |
prompt=full_prompt,
|
42 |
negative_prompt="(deformed, distorted, disfigured:1.3), poorly drawn, bad anatomy, wrong anatomy, extra limb, missing limb, floating limbs, (mutated hands and fingers:1.4), disconnected limbs, mutation, mutated, ugly, disgusting, blurry, amputation",
|
43 |
use_negative_prompt=True,
|
|
|
46 |
width=width,
|
47 |
height=height,
|
48 |
guidance_scale=5,
|
49 |
+
randomize_seed=True
|
50 |
+
}
|
51 |
)
|
52 |
logger.info("Image generation successful.")
|
53 |
+
response.raise_for_status()
|
54 |
+
result = response.json()
|
55 |
return result
|
56 |
+
except requests.RequestException as e:
|
57 |
+
print(f"Request exception: {e}")
|
58 |
return None
|
59 |
|
60 |
def request_otp(user_chat_id):
|