Spaces:
Running
Running
limit string length
Browse files
app.py
CHANGED
|
@@ -13,6 +13,10 @@ data = []
|
|
| 13 |
|
| 14 |
model = GroqModel('llama-3.1-70b-versatile', api_key = api_key)
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
async def ppt_content(data):
|
| 17 |
agent = Agent(model,system_prompt=(
|
| 18 |
"You are an expert in making power-point perssentation",
|
|
@@ -24,8 +28,11 @@ async def ppt_content(data):
|
|
| 24 |
"Conclusion Slide: State the overall conclusion.",
|
| 25 |
"Reference Slide: Include all citations used."
|
| 26 |
))
|
| 27 |
-
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
def ai_ppt(data):
|
| 31 |
asyncio.run(ppt_content(data=data))
|
|
|
|
| 13 |
|
| 14 |
model = GroqModel('llama-3.1-70b-versatile', api_key = api_key)
|
| 15 |
|
| 16 |
+
def split_long_string(long_string, chunk_size=6000):
|
| 17 |
+
return [long_string[i:i+chunk_size] for i in range(0, len(long_string), chunk_size)]
|
| 18 |
+
|
| 19 |
+
|
| 20 |
async def ppt_content(data):
|
| 21 |
agent = Agent(model,system_prompt=(
|
| 22 |
"You are an expert in making power-point perssentation",
|
|
|
|
| 28 |
"Conclusion Slide: State the overall conclusion.",
|
| 29 |
"Reference Slide: Include all citations used."
|
| 30 |
))
|
| 31 |
+
listOfString = split_long_string("".join(data))
|
| 32 |
+
|
| 33 |
+
result_1 = agent.run_sync(user_prompt = listOfString[0])
|
| 34 |
+
result_2 = agent.run_sync(user_prompt = listOfString[1],message_history=result_1.new_messages())
|
| 35 |
+
print(result_2.data)
|
| 36 |
|
| 37 |
def ai_ppt(data):
|
| 38 |
asyncio.run(ppt_content(data=data))
|