Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,36 +2,66 @@ import gradio as gr
|
|
| 2 |
import requests
|
| 3 |
import json
|
| 4 |
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
"Content-Type": "application/json"
|
| 8 |
-
}
|
| 9 |
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
return image_url
|
| 26 |
-
else:
|
| 27 |
-
return "Error: No image data in the response."
|
| 28 |
-
else:
|
| 29 |
-
return f"Error: {response.status_code}"
|
| 30 |
-
except json.JSONDecodeError:
|
| 31 |
-
return "Error: Invalid JSON response."
|
| 32 |
-
except Exception as e:
|
| 33 |
-
return str(e)
|
| 34 |
|
| 35 |
-
|
| 36 |
-
iface = gr.Interface(fn=generate_image, inputs=[gr.Textbox(label="Enter prompt"), gr.Radio(["dalle2"], label="Select Model")], outputs="image", title="DALLE2 Generation", description="Disclaimer: This uses the Nexra API for image generation. I cannot guarantee rate limits, if you do not recieve an image please try again. I will change to use a different API soon. DALL-E 3 is not supported yet.")
|
| 37 |
-
iface.launch()
|
|
|
|
| 2 |
import requests
|
| 3 |
import json
|
| 4 |
|
| 5 |
+
<!DOCTYPE html>
|
| 6 |
+
<html>
|
|
|
|
|
|
|
| 7 |
|
| 8 |
+
<head>
|
| 9 |
+
<meta charset="utf-8" />
|
| 10 |
+
<meta name="viewport" content="width=device-width" />
|
| 11 |
+
<title>Realistic Image Generator Model</title>
|
| 12 |
+
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap" rel="stylesheet">
|
| 13 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
|
| 14 |
+
<style>
|
| 15 |
+
body {
|
| 16 |
+
margin: 0;
|
| 17 |
+
font-family: 'Poppins', sans-serif;
|
| 18 |
+
}
|
| 19 |
+
.fullframe {
|
| 20 |
+
max-width: 100%;
|
| 21 |
+
max-height: 100%;
|
| 22 |
+
width: 100vw;
|
| 23 |
+
height: 100vh;
|
| 24 |
+
overflow: hidden;
|
| 25 |
+
}
|
| 26 |
+
.iframe-element {
|
| 27 |
+
min-width: 100%;
|
| 28 |
+
min-height: 100%;
|
| 29 |
+
}
|
| 30 |
+
.floating-button {
|
| 31 |
+
position: fixed;
|
| 32 |
+
bottom: 30px;
|
| 33 |
+
left: 20px;
|
| 34 |
+
background-color: #dbdad7;
|
| 35 |
+
color: black;
|
| 36 |
+
padding: 15px 25px;
|
| 37 |
+
border: none;
|
| 38 |
+
border-radius: 10px;
|
| 39 |
+
font-size: 13px;
|
| 40 |
+
font-weight: bold;
|
| 41 |
+
cursor: pointer;
|
| 42 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
| 43 |
+
transition: background-color 0.3s, box-shadow 0.3s;
|
| 44 |
+
text-decoration: none;
|
| 45 |
+
font-family: 'Poppins', sans-serif;
|
| 46 |
+
display: flex;
|
| 47 |
+
align-items: center;
|
| 48 |
+
justify-content: center;
|
| 49 |
+
}
|
| 50 |
+
.floating-button:hover {
|
| 51 |
+
background-color: #dbdad7;
|
| 52 |
+
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
|
| 53 |
+
}
|
| 54 |
+
.floating-button i {
|
| 55 |
+
margin-right: 10px;
|
| 56 |
+
}
|
| 57 |
+
</style>
|
| 58 |
+
</head>
|
| 59 |
|
| 60 |
+
<body>
|
| 61 |
+
<div class="fullframe">
|
| 62 |
+
<iframe class="iframe-element" allowfullscreen="true" frameborder="0" src="https://artificialguybr-realvisxl-free-demo.hf.space">
|
| 63 |
+
</iframe>
|
| 64 |
+
</div>
|
| 65 |
+
</body>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
|
| 67 |
+
</html>
|
|
|
|
|
|