Update app.py
Browse files
app.py
CHANGED
@@ -15,18 +15,19 @@ ZEPHYR_API_URL = "https://api-inference.huggingface.co/models/HuggingFaceH4/zeph
|
|
15 |
SD_API_URL = "https://api-inference.huggingface.co/models/stabilityai/stable-diffusion-xl-base-1.0"
|
16 |
|
17 |
def query_zephyr(linkedin_text):
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
"text": instruction + " " + linkedin_text # Assuming direct instruction followed by the query
|
22 |
-
}
|
23 |
-
}
|
24 |
-
|
25 |
headers = {
|
26 |
"Authorization": f"Bearer {ZEPHYR_API_TOKEN}",
|
27 |
"Content-Type": "application/json",
|
28 |
}
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
30 |
response = requests.post(ZEPHYR_API_URL, headers=headers, json=payload)
|
31 |
if response.status_code == 200:
|
32 |
return response.json()
|
|
|
15 |
SD_API_URL = "https://api-inference.huggingface.co/models/stabilityai/stable-diffusion-xl-base-1.0"
|
16 |
|
17 |
def query_zephyr(linkedin_text):
|
18 |
+
# Constructing a single string prompt that combines the instruction with the LinkedIn post text
|
19 |
+
prompt = f"Prepare a prompt for Stable Diffusion for the following LinkedIn post: {linkedin_text}"
|
20 |
+
|
|
|
|
|
|
|
|
|
21 |
headers = {
|
22 |
"Authorization": f"Bearer {ZEPHYR_API_TOKEN}",
|
23 |
"Content-Type": "application/json",
|
24 |
}
|
25 |
+
|
26 |
+
# The `inputs` field now directly contains the prompt string
|
27 |
+
payload = {
|
28 |
+
"inputs": prompt,
|
29 |
+
}
|
30 |
+
|
31 |
response = requests.post(ZEPHYR_API_URL, headers=headers, json=payload)
|
32 |
if response.status_code == 200:
|
33 |
return response.json()
|