Spaces:
Running
Running
improve prompt
Browse files
app.py
CHANGED
|
@@ -7,10 +7,13 @@ import nest_asyncio
|
|
| 7 |
import pdfplumber
|
| 8 |
import os
|
| 9 |
|
|
|
|
| 10 |
api_key = os.getenv("API_KEY")
|
| 11 |
data = []
|
| 12 |
|
| 13 |
|
|
|
|
|
|
|
| 14 |
model = GroqModel('llama-3.1-70b-versatile', api_key = api_key)
|
| 15 |
|
| 16 |
def split_long_string(long_string, chunk_size=6000):
|
|
@@ -20,13 +23,15 @@ def split_long_string(long_string, chunk_size=6000):
|
|
| 20 |
async def ppt_content(data):
|
| 21 |
agent = Agent(model,system_prompt=(
|
| 22 |
"You are an expert in making power-point perssentation",
|
|
|
|
|
|
|
| 23 |
"Title Slide: Include the document's title, subtitle, author, and date.",
|
| 24 |
"Methodology Slide: Summarize the methodology in detail",
|
| 25 |
"Results Slide: Present key findings in detail in simple text and bullet points.",
|
| 26 |
"Discussion Slide: Summarize the implications and limitations.",
|
| 27 |
"Conclusion Slide: State the overall conclusion.",
|
| 28 |
"Reference Slide: Include all citations used.",
|
| 29 |
-
|
| 30 |
))
|
| 31 |
listOfString = split_long_string("".join(data))
|
| 32 |
print(len(listOfString))
|
|
@@ -39,12 +44,8 @@ async def ppt_content(data):
|
|
| 39 |
|
| 40 |
result_1 = agent.run_sync(user_prompt = listOfString[0])
|
| 41 |
result_2 = agent.run_sync(user_prompt = listOfString[1],message_history=result_1.new_messages())
|
| 42 |
-
result_3 = agent.run_sync(user_prompt = listOfString[2],message_history=result_2.new_messages())
|
| 43 |
-
result_4 = agent.run_sync(user_prompt = listOfString[3],message_history=result_3.new_messages())
|
| 44 |
-
result_5 = agent.run_sync(user_prompt = listOfString[4],message_history=result_4.new_messages())
|
| 45 |
-
result_6 = agent.run_sync(user_prompt = listOfString[5],message_history=result_5.new_messages())
|
| 46 |
|
| 47 |
-
print(
|
| 48 |
|
| 49 |
def ai_ppt(data):
|
| 50 |
asyncio.run(ppt_content(data=data))
|
|
|
|
| 7 |
import pdfplumber
|
| 8 |
import os
|
| 9 |
|
| 10 |
+
|
| 11 |
api_key = os.getenv("API_KEY")
|
| 12 |
data = []
|
| 13 |
|
| 14 |
|
| 15 |
+
|
| 16 |
+
|
| 17 |
model = GroqModel('llama-3.1-70b-versatile', api_key = api_key)
|
| 18 |
|
| 19 |
def split_long_string(long_string, chunk_size=6000):
|
|
|
|
| 23 |
async def ppt_content(data):
|
| 24 |
agent = Agent(model,system_prompt=(
|
| 25 |
"You are an expert in making power-point perssentation",
|
| 26 |
+
"Create 6 sliders",
|
| 27 |
+
"Each slide should be seperate"
|
| 28 |
"Title Slide: Include the document's title, subtitle, author, and date.",
|
| 29 |
"Methodology Slide: Summarize the methodology in detail",
|
| 30 |
"Results Slide: Present key findings in detail in simple text and bullet points.",
|
| 31 |
"Discussion Slide: Summarize the implications and limitations.",
|
| 32 |
"Conclusion Slide: State the overall conclusion.",
|
| 33 |
"Reference Slide: Include all citations used.",
|
| 34 |
+
|
| 35 |
))
|
| 36 |
listOfString = split_long_string("".join(data))
|
| 37 |
print(len(listOfString))
|
|
|
|
| 44 |
|
| 45 |
result_1 = agent.run_sync(user_prompt = listOfString[0])
|
| 46 |
result_2 = agent.run_sync(user_prompt = listOfString[1],message_history=result_1.new_messages())
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
|
| 48 |
+
print(result_2.data)
|
| 49 |
|
| 50 |
def ai_ppt(data):
|
| 51 |
asyncio.run(ppt_content(data=data))
|