Jangai commited on
Commit
5790eb2
·
verified ·
1 Parent(s): 48a98b7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -7
app.py CHANGED
@@ -16,19 +16,26 @@ SD_API_URL = "https://api-inference.huggingface.co/models/stabilityai/stable-dif
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:"
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
-
29
- "role": "system", "content": prompt,
30
- "role": "user", "content": linkedin_text
 
 
 
 
 
 
 
31
  }
 
32
 
33
  response = requests.post(ZEPHYR_API_URL, headers=headers, json=payload)
34
  if response.status_code == 200:
 
16
 
17
  def query_zephyr(linkedin_text):
18
  # Constructing a single string prompt that combines the instruction with the LinkedIn post text
19
+
 
20
  headers = {
21
  "Authorization": f"Bearer {ZEPHYR_API_TOKEN}",
22
  "Content-Type": "application/json",
23
  }
24
 
25
+ prompt = "Prepare a prompt for Stable Diffusion for the following LinkedIn post:"
26
+ conversation = [
27
+ {"role": "system", "content": prompt},
28
+ {"role": "user", "content": linkedin_text}
29
+ ]
30
+
31
+ payload = {
32
+ "inputs": {
33
+ "past_user_inputs": [],
34
+ "generated_responses": [],
35
+ "text": linkedin_text, # This might need adjustment based on the model's requirements.
36
+ "conversation": conversation,
37
  }
38
+ }
39
 
40
  response = requests.post(ZEPHYR_API_URL, headers=headers, json=payload)
41
  if response.status_code == 200: