Jangai commited on
Commit
feb4867
·
verified ·
1 Parent(s): f4ea50e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -8
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
- instruction = "Prepare a prompt for Stable Diffusion for the following LinkedIn post:"
19
- payload = {
20
- "inputs": {
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()