Spaces:
Runtime error
Runtime error
gaspar-avit
commited on
Commit
•
e0d3b95
1
Parent(s):
ad562e0
Upload app.py
Browse files
app.py
CHANGED
@@ -186,11 +186,16 @@ def query_generate(text):
|
|
186 |
API_URL = "https://api-inference.huggingface.co/models/runwayml/stable-diffusion-v1-5"
|
187 |
headers = {"Authorization": f"Bearer {st.secrets['hf_token']}"}
|
188 |
text = "Poster of movie. " + text
|
189 |
-
payload = {"inputs": f"{text}",
|
190 |
-
"options": {"wait_for_model": True},
|
191 |
-
}
|
192 |
|
193 |
response = requests.post(API_URL, headers=headers, json=payload)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
return response.content
|
195 |
|
196 |
@st.experimental_memo(persist=False, show_spinner=False, suppress_st_warning=True)
|
|
|
186 |
API_URL = "https://api-inference.huggingface.co/models/runwayml/stable-diffusion-v1-5"
|
187 |
headers = {"Authorization": f"Bearer {st.secrets['hf_token']}"}
|
188 |
text = "Poster of movie. " + text
|
189 |
+
payload = {"inputs": f"{text}",}
|
|
|
|
|
190 |
|
191 |
response = requests.post(API_URL, headers=headers, json=payload)
|
192 |
+
|
193 |
+
if 'error' in response.content.decode("utf-8"):
|
194 |
+
payload = {"inputs": f"{text}",
|
195 |
+
"options": {"wait_for_model": True},
|
196 |
+
}
|
197 |
+
response = requests.post(API_URL, headers=headers, json=payload)
|
198 |
+
|
199 |
return response.content
|
200 |
|
201 |
@st.experimental_memo(persist=False, show_spinner=False, suppress_st_warning=True)
|