Spaces:
Running
Running
new idea implementation
Browse files
app.py
CHANGED
@@ -4,6 +4,7 @@ import streamlit as st
|
|
4 |
from pydantic_ai import Agent,RunContext, Tool
|
5 |
from pydantic_ai.models.groq import GroqModel
|
6 |
import nest_asyncio
|
|
|
7 |
import pdfplumber
|
8 |
#from transformers import pipeline
|
9 |
#import torch
|
@@ -58,7 +59,6 @@ class SupportDependencies:
|
|
58 |
async def ppt_content(data):
|
59 |
agent = Agent(model,
|
60 |
result_type=customClass.PPT,
|
61 |
-
deps_type=SupportDependencies,
|
62 |
tools=[
|
63 |
return_data,
|
64 |
],
|
@@ -80,18 +80,23 @@ async def ppt_content(data):
|
|
80 |
))
|
81 |
listOfString = split_into_token_chunks("".join(data))
|
82 |
print(len(listOfString))
|
|
|
83 |
# for i, chunk in enumerate(listOfString):
|
84 |
# print(f"Chunk {i}:\n{chunk}\n")
|
85 |
|
86 |
-
|
87 |
-
|
88 |
-
|
|
|
89 |
|
90 |
|
91 |
deps :SupportDependencies = SupportDependencies(db="".join(data))
|
92 |
-
|
93 |
-
|
94 |
-
|
|
|
|
|
|
|
95 |
|
96 |
|
97 |
def ai_ppt(data):
|
|
|
4 |
from pydantic_ai import Agent,RunContext, Tool
|
5 |
from pydantic_ai.models.groq import GroqModel
|
6 |
import nest_asyncio
|
7 |
+
from pydantic_ai.messages import ModelMessage
|
8 |
import pdfplumber
|
9 |
#from transformers import pipeline
|
10 |
#import torch
|
|
|
59 |
async def ppt_content(data):
|
60 |
agent = Agent(model,
|
61 |
result_type=customClass.PPT,
|
|
|
62 |
tools=[
|
63 |
return_data,
|
64 |
],
|
|
|
80 |
))
|
81 |
listOfString = split_into_token_chunks("".join(data))
|
82 |
print(len(listOfString))
|
83 |
+
message_history: list[ModelMessage] = []
|
84 |
# for i, chunk in enumerate(listOfString):
|
85 |
# print(f"Chunk {i}:\n{chunk}\n")
|
86 |
|
87 |
+
for x in listOfString:
|
88 |
+
result = agent.run_sync(user_prompt = f"Create me a powerpoint presentation {x}",message_history = message_history)
|
89 |
+
message_history = result.all_messages()
|
90 |
+
print(result)
|
91 |
|
92 |
|
93 |
deps :SupportDependencies = SupportDependencies(db="".join(data))
|
94 |
+
# while len(listOfString) > 0:
|
95 |
+
|
96 |
+
# result_1 = agent.run_sync(user_prompt = f"Create me a powerpoint presentation",message_history=message_history)
|
97 |
+
# #print(result_1.data)
|
98 |
+
# message_history = result_1.all_messages()
|
99 |
+
# print(result_1)
|
100 |
|
101 |
|
102 |
def ai_ppt(data):
|