Spaces:
Runtime error
Runtime error
Commit ·
9ebedb6
1
Parent(s): f7716a6
Upload app.py
Browse files
app.py
CHANGED
|
@@ -8,6 +8,8 @@ import json
|
|
| 8 |
import requests
|
| 9 |
import os
|
| 10 |
import io
|
|
|
|
|
|
|
| 11 |
from streamlit import session_state as session
|
| 12 |
from datetime import time, datetime
|
| 13 |
from zipfile import ZipFile
|
|
@@ -185,7 +187,8 @@ def query_generate(text, genres, year):
|
|
| 185 |
"""
|
| 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 + ', year ' + year
|
|
|
|
| 189 |
payload = {"inputs": f"{text}",}
|
| 190 |
|
| 191 |
response = requests.post(API_URL, headers=headers, json=payload)
|
|
|
|
| 8 |
import requests
|
| 9 |
import os
|
| 10 |
import io
|
| 11 |
+
import string
|
| 12 |
+
import random
|
| 13 |
from streamlit import session_state as session
|
| 14 |
from datetime import time, datetime
|
| 15 |
from zipfile import ZipFile
|
|
|
|
| 187 |
"""
|
| 188 |
API_URL = "https://api-inference.huggingface.co/models/runwayml/stable-diffusion-v1-5"
|
| 189 |
headers = {"Authorization": f"Bearer {st.secrets['hf_token']}"}
|
| 190 |
+
text = 'A movie Poster based on the following synopsis: \"' + text + '\". Style: ' + genres + ', year ' + year + \
|
| 191 |
+
'. Ignore ' + ''.join(random.choices(string.ascii_letters, k=10))
|
| 192 |
payload = {"inputs": f"{text}",}
|
| 193 |
|
| 194 |
response = requests.post(API_URL, headers=headers, json=payload)
|