Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,29 +17,29 @@ if API_KEY:
|
|
| 17 |
|
| 18 |
# Page configuration
|
| 19 |
st.set_page_config(
|
| 20 |
-
page_title="Multimodal AI Agent
|
| 21 |
page_icon="π₯",
|
| 22 |
layout="wide"
|
| 23 |
)
|
| 24 |
|
| 25 |
-
st.title("Phidata Video AI
|
| 26 |
st.header("Powered by Gemini 2.0 Flash Exp")
|
| 27 |
|
| 28 |
@st.cache_resource
|
| 29 |
def initialize_agent():
|
| 30 |
return Agent(
|
| 31 |
-
name="Video AI
|
| 32 |
-
model=Gemini(id="
|
| 33 |
tools=[DuckDuckGo()],
|
| 34 |
markdown=True,
|
| 35 |
)
|
| 36 |
|
| 37 |
-
|
| 38 |
multimodal_Agent = initialize_agent()
|
| 39 |
|
| 40 |
# File uploader
|
| 41 |
video_file = st.file_uploader(
|
| 42 |
-
"Upload a video file", type=['mp4'
|
| 43 |
)
|
| 44 |
|
| 45 |
if video_file:
|
|
@@ -67,26 +67,26 @@ if video_file:
|
|
| 67 |
time.sleep(1)
|
| 68 |
processed_video = get_file(processed_video.name)
|
| 69 |
|
| 70 |
-
# Enhanced prompt for detailed
|
| 71 |
analysis_prompt = (
|
| 72 |
f"""
|
| 73 |
-
Analyze the uploaded video thoroughly and
|
| 74 |
-
|
| 75 |
Your notes should:
|
| 76 |
-
- Begin with a
|
| 77 |
-
-
|
| 78 |
-
-
|
| 79 |
-
- Include
|
| 80 |
-
-
|
| 81 |
-
-
|
| 82 |
-
-
|
| 83 |
-
-
|
| 84 |
|
| 85 |
-
IMPORTANT:
|
| 86 |
|
| 87 |
Additional context/question from user: {user_query}
|
| 88 |
|
| 89 |
-
The
|
| 90 |
"""
|
| 91 |
)
|
| 92 |
|
|
@@ -112,4 +112,3 @@ if video_file:
|
|
| 112 |
Path(video_path).unlink(missing_ok=True)
|
| 113 |
else:
|
| 114 |
st.info("Upload a video file to begin analysis.")
|
| 115 |
-
|
|
|
|
| 17 |
|
| 18 |
# Page configuration
|
| 19 |
st.set_page_config(
|
| 20 |
+
page_title="Multimodal AI Agent Video Notes Writer",
|
| 21 |
page_icon="π₯",
|
| 22 |
layout="wide"
|
| 23 |
)
|
| 24 |
|
| 25 |
+
st.title("Phidata Video AI Notes Writer π₯π€π¬")
|
| 26 |
st.header("Powered by Gemini 2.0 Flash Exp")
|
| 27 |
|
| 28 |
@st.cache_resource
|
| 29 |
def initialize_agent():
|
| 30 |
return Agent(
|
| 31 |
+
name="Video AI Notes-Writer",
|
| 32 |
+
model=Gemini(id="Gemini-2.0-flash-exp"),
|
| 33 |
tools=[DuckDuckGo()],
|
| 34 |
markdown=True,
|
| 35 |
)
|
| 36 |
|
| 37 |
+
# Initialize the agent
|
| 38 |
multimodal_Agent = initialize_agent()
|
| 39 |
|
| 40 |
# File uploader
|
| 41 |
video_file = st.file_uploader(
|
| 42 |
+
"Upload a video file", type=['mp4'], help="Upload a video for AI analysis"
|
| 43 |
)
|
| 44 |
|
| 45 |
if video_file:
|
|
|
|
| 67 |
time.sleep(1)
|
| 68 |
processed_video = get_file(processed_video.name)
|
| 69 |
|
| 70 |
+
# Enhanced prompt for detailed student-style notes with improved structure
|
| 71 |
analysis_prompt = (
|
| 72 |
f"""
|
| 73 |
+
Analyze the uploaded video thoroughly and generate EXTREMELY DETAILED STUDENT NOTES in full paragraph format.
|
| 74 |
+
|
| 75 |
Your notes should:
|
| 76 |
+
- Begin with a comprehensive introduction that outlines the topic and objectives.
|
| 77 |
+
- Divide the content into clearly labeled sections with headings and subheadings (e.g., "Introduction", "Main Concepts", "Detailed Explanations", and "Conclusion").
|
| 78 |
+
- Provide detailed explanations of key concepts, ensuring each section includes a narrative summary of its key takeaways.
|
| 79 |
+
- Include smooth transitions between sections and paragraphs for a cohesive flow.
|
| 80 |
+
- Reference and explain any visual aids, diagrams, or slides mentioned in the lecture.
|
| 81 |
+
- Incorporate reflective questions or critical insights to prompt further analysis of the material.
|
| 82 |
+
- Maintain a student-friendly yet rigorous tone, similar to well-structured textbook content.
|
| 83 |
+
- Conclude with a summary paragraph that encapsulates the main ideas.
|
| 84 |
|
| 85 |
+
IMPORTANT: DO NOT use bullet points or lists. Present all information in well-developed paragraphs.
|
| 86 |
|
| 87 |
Additional context/question from user: {user_query}
|
| 88 |
|
| 89 |
+
The final output should resemble detailed, structured textbook content that thoroughly explains all concepts from the video.
|
| 90 |
"""
|
| 91 |
)
|
| 92 |
|
|
|
|
| 112 |
Path(video_path).unlink(missing_ok=True)
|
| 113 |
else:
|
| 114 |
st.info("Upload a video file to begin analysis.")
|
|
|