Spaces:
Sleeping
Sleeping
create ppt content
Browse files
app.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
from pydantic_ai import Agent
|
| 3 |
from pydantic_ai.models.groq import GroqModel
|
|
@@ -12,6 +13,24 @@ data = []
|
|
| 12 |
|
| 13 |
model = GroqModel('llama-3.1-70b-versatile', api_key = api_key)
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
def extract_data(feed):
|
| 16 |
|
| 17 |
with pdfplumber.open(feed) as pdf:
|
|
@@ -26,6 +45,12 @@ if uploaded_file is not None:
|
|
| 26 |
|
| 27 |
if data is not None:
|
| 28 |
st.caption(data)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
|
| 31 |
|
|
|
|
| 1 |
+
import asyncio
|
| 2 |
import streamlit as st
|
| 3 |
from pydantic_ai import Agent
|
| 4 |
from pydantic_ai.models.groq import GroqModel
|
|
|
|
| 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",
|
| 19 |
+
"Convert the content of the attached PDF into PowerPoint slides",
|
| 20 |
+
"Title Slide: Include the document's title, subtitle, author, and date.",
|
| 21 |
+
"Methodology Slide: Summarize the methodology in bullet points",
|
| 22 |
+
"Results Slide: Present key findings using tables or charts.",
|
| 23 |
+
"Discussion Slide: Summarize the implications and limitations.",
|
| 24 |
+
"Conclusion Slide: State the overall conclusion.",
|
| 25 |
+
"Reference Slide: Include all citations used."
|
| 26 |
+
))
|
| 27 |
+
result_1 = agent.run_sync(user_prompt=data)
|
| 28 |
+
print(result_1.data)
|
| 29 |
+
|
| 30 |
+
def ai_ppt(data):
|
| 31 |
+
asyncio.run(ppt_content(data=data))
|
| 32 |
+
|
| 33 |
+
|
| 34 |
def extract_data(feed):
|
| 35 |
|
| 36 |
with pdfplumber.open(feed) as pdf:
|
|
|
|
| 45 |
|
| 46 |
if data is not None:
|
| 47 |
st.caption(data)
|
| 48 |
+
ai_ppt(data=data)
|
| 49 |
+
|
| 50 |
+
# if __name__ == '__main__':
|
| 51 |
+
# import asyncio
|
| 52 |
+
# nest_asyncio.apply()
|
| 53 |
+
# asyncio.run(ppt_content())
|
| 54 |
|
| 55 |
|
| 56 |
|