Update presentation_assistant/presentation_assistant.py
Browse files
presentation_assistant/presentation_assistant.py
CHANGED
@@ -13,7 +13,7 @@ API_URL = "https://api-inference.huggingface.co/models/meta-llama/Llama-2-70b-ch
|
|
13 |
headers = {"Authorization": "Bearer "+hf_token}
|
14 |
|
15 |
def query(payload):
|
16 |
-
response = requests.post(API_URL, headers=headers, json=payload
|
17 |
return response.json()
|
18 |
|
19 |
sys.path.append("/home/user/app")
|
@@ -73,8 +73,12 @@ def generate_text2ppt_input_prompt(input_type, input_value, input_pages):
|
|
73 |
|
74 |
# Function to execute text2ppt
|
75 |
def text2ppt(token_key, input_prompt, input_theme):
|
76 |
-
output = query({"inputs": "You are a kind helpful PPT designer. "+input_prompt
|
77 |
-
|
|
|
|
|
|
|
|
|
78 |
print(reply)
|
79 |
md_text = reply[4:] if reply[:3] == "---" else reply
|
80 |
md_text_list = md_text.split('\n')
|
@@ -132,8 +136,12 @@ def ppt2script(token_key, input_file, input_type):
|
|
132 |
"""
|
133 |
|
134 |
input_prompt = header + text
|
135 |
-
|
136 |
-
output = query({"inputs": "You are a kind helpful PPT Assistant."+input_prompt
|
137 |
-
|
|
|
|
|
|
|
|
|
138 |
|
139 |
return reply
|
|
|
13 |
headers = {"Authorization": "Bearer "+hf_token}
|
14 |
|
15 |
def query(payload):
|
16 |
+
response = requests.post(API_URL, headers=headers, json=payload)
|
17 |
return response.json()
|
18 |
|
19 |
sys.path.append("/home/user/app")
|
|
|
73 |
|
74 |
# Function to execute text2ppt
|
75 |
def text2ppt(token_key, input_prompt, input_theme):
|
76 |
+
output = query({"inputs": "You are a kind helpful PPT designer. "+input_prompt,
|
77 |
+
"parameters": {
|
78 |
+
"return_full_text": True,
|
79 |
+
"max_new_tokens": 500})
|
80 |
+
# reply = output[0]['generated_text'][len("You are a kind helpful PPT designer. "+input_prompt):]
|
81 |
+
reply = output[0]['generated_text']
|
82 |
print(reply)
|
83 |
md_text = reply[4:] if reply[:3] == "---" else reply
|
84 |
md_text_list = md_text.split('\n')
|
|
|
136 |
"""
|
137 |
|
138 |
input_prompt = header + text
|
139 |
+
|
140 |
+
output = query({"inputs": "You are a kind helpful PPT Assistant."+input_prompt,
|
141 |
+
"parameters": {
|
142 |
+
"return_full_text": True,
|
143 |
+
"max_new_tokens": 500})})
|
144 |
+
# reply = output[0]['generated_text'][len("You are a kind helpful PPT Assistant."+input_prompt):]
|
145 |
+
reply = output[0]['generated_text']
|
146 |
|
147 |
return reply
|