Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -6,12 +6,14 @@ import requests
|
|
6 |
from io import BytesIO
|
7 |
import re
|
8 |
|
|
|
9 |
def fetch_api_endpoint(url):
|
10 |
try:
|
11 |
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3'}
|
12 |
response = requests.get(url, headers=headers)
|
13 |
response.raise_for_status() # Raise exception for HTTP errors
|
14 |
|
|
|
15 |
endpoint_match = re.search(r'root":"(https://[^"]+)', response.text)
|
16 |
if endpoint_match:
|
17 |
endpoint_url = endpoint_match.group(1)
|
@@ -129,15 +131,16 @@ with gr.Blocks(css=css) as app:
|
|
129 |
outputs=[image_output]
|
130 |
)
|
131 |
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
|
|
141 |
|
142 |
gr.Markdown("""
|
143 |
---
|
|
|
6 |
from io import BytesIO
|
7 |
import re
|
8 |
|
9 |
+
# Function to fetch the API endpoint from the URL using regular expressions
|
10 |
def fetch_api_endpoint(url):
|
11 |
try:
|
12 |
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3'}
|
13 |
response = requests.get(url, headers=headers)
|
14 |
response.raise_for_status() # Raise exception for HTTP errors
|
15 |
|
16 |
+
# Use regular expressions to find the endpoint URL in the script content
|
17 |
endpoint_match = re.search(r'root":"(https://[^"]+)', response.text)
|
18 |
if endpoint_match:
|
19 |
endpoint_url = endpoint_match.group(1)
|
|
|
131 |
outputs=[image_output]
|
132 |
)
|
133 |
|
134 |
+
with gr.Row():
|
135 |
+
gr.HTML("<h2>Generated Examples</h2>")
|
136 |
+
gr.Markdown("""
|
137 |
+
| **Preview Image** | **Used Prompt** | **Width** | **Height** | **Guidance Scale** | **Seed** |
|
138 |
+
|-------------------|--------------------------------|------------|-------------|--------------------|----------|
|
139 |
+
| ![Preview](https://i.imgur.com/CBvJ3sy.png) | Coffeeshop website logo | 1024 | 1024 | 3 | 0 |
|
140 |
+
| ![Preview](https://i.imgur.com/i2XpinX.png) | Bio food website logo | 1024 | 1024 | 3 | 0 |
|
141 |
+
| ![Preview](https://i.imgur.com/HeEjh4T.png) | Car Selling website logo | 1024 | 1024 | 3 | 0 |
|
142 |
+
""")
|
143 |
+
|
144 |
|
145 |
gr.Markdown("""
|
146 |
---
|