Spaces:
Runtime error
Runtime error
gaspar-avit
commited on
Commit
•
a7ea406
1
Parent(s):
0d1c5b9
Upload app.py
Browse files
app.py
CHANGED
@@ -186,19 +186,17 @@ def query_generate(text, genres):
|
|
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 = 'A movie Poster based on the following synopsis: \"' + text + '\". Style: ' + genres
|
189 |
-
st.write('INFO: '+text)
|
190 |
payload = {"inputs": f"{text}",}
|
191 |
|
192 |
response = requests.post(API_URL, headers=headers, json=payload)
|
193 |
|
|
|
194 |
if isinstance(response.content, str):
|
195 |
-
|
196 |
-
# if 'error' in response.content.decode("utf-8"):
|
197 |
payload = {"inputs": f"{text}",
|
198 |
"options": {"wait_for_model": True},
|
199 |
}
|
200 |
response = requests.post(API_URL, headers=headers, json=payload)
|
201 |
-
|
202 |
|
203 |
return response.content
|
204 |
|
@@ -222,7 +220,7 @@ def generate_poster(movie_data):
|
|
222 |
|
223 |
# Print summarized synopsis
|
224 |
st.text("")
|
225 |
-
synopsis_expander = st.expander("Show synopsis", expanded=
|
226 |
with synopsis_expander:
|
227 |
st.subheader("Summarized synopsis:")
|
228 |
col1, col2 = st.columns([5, 1])
|
|
|
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 = 'A movie Poster based on the following synopsis: \"' + text + '\". Style: ' + genres
|
|
|
189 |
payload = {"inputs": f"{text}",}
|
190 |
|
191 |
response = requests.post(API_URL, headers=headers, json=payload)
|
192 |
|
193 |
+
_="""
|
194 |
if isinstance(response.content, str):
|
|
|
|
|
195 |
payload = {"inputs": f"{text}",
|
196 |
"options": {"wait_for_model": True},
|
197 |
}
|
198 |
response = requests.post(API_URL, headers=headers, json=payload)
|
199 |
+
"""
|
200 |
|
201 |
return response.content
|
202 |
|
|
|
220 |
|
221 |
# Print summarized synopsis
|
222 |
st.text("")
|
223 |
+
synopsis_expander = st.expander("Show synopsis", expanded=False)
|
224 |
with synopsis_expander:
|
225 |
st.subheader("Summarized synopsis:")
|
226 |
col1, col2 = st.columns([5, 1])
|