Update presentation_assistant/presentation_assistant.py
Browse files
presentation_assistant/presentation_assistant.py
CHANGED
|
@@ -78,8 +78,9 @@ def text2ppt(token_key, input_prompt, input_theme):
|
|
| 78 |
"return_full_text": False,
|
| 79 |
"max_new_tokens": 200}})
|
| 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')
|
| 85 |
print(md_text_list)
|
|
@@ -89,7 +90,7 @@ def text2ppt(token_key, input_prompt, input_theme):
|
|
| 89 |
# data = ""
|
| 90 |
# if md_text_list[i] and "<!--" in md_text_list[i]:
|
| 91 |
# data = "---" + "\n"
|
| 92 |
-
data = md_text_list[i] + "\n"
|
| 93 |
# print(data)
|
| 94 |
f.write(data)
|
| 95 |
f.close()
|
|
@@ -147,6 +148,6 @@ def ppt2script(token_key, input_file, input_type):
|
|
| 147 |
"return_full_text": False,
|
| 148 |
"max_new_tokens": 200}})
|
| 149 |
# reply = output[0]['generated_text'][len("You are a kind helpful PPT Assistant."+input_prompt):]
|
| 150 |
-
reply = output[0]['generated_text']
|
| 151 |
|
| 152 |
return reply
|
|
|
|
| 78 |
"return_full_text": False,
|
| 79 |
"max_new_tokens": 200}})
|
| 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 |
+
|
| 84 |
md_text = reply[4:] if reply[:3] == "---" else reply
|
| 85 |
md_text_list = md_text.split('\n')
|
| 86 |
print(md_text_list)
|
|
|
|
| 90 |
# data = ""
|
| 91 |
# if md_text_list[i] and "<!--" in md_text_list[i]:
|
| 92 |
# data = "---" + "\n"
|
| 93 |
+
data = md_text_list[i].strip() + "\n"
|
| 94 |
# print(data)
|
| 95 |
f.write(data)
|
| 96 |
f.close()
|
|
|
|
| 148 |
"return_full_text": False,
|
| 149 |
"max_new_tokens": 200}})
|
| 150 |
# reply = output[0]['generated_text'][len("You are a kind helpful PPT Assistant."+input_prompt):]
|
| 151 |
+
reply = output[0]['generated_text']
|
| 152 |
|
| 153 |
return reply
|