{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from dotenv import load_dotenv\n", "load_dotenv()\n", "import os \n", "\n", "api_key = os.environ.get('GOOGLE_API_KEY')" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "import google.generativeai as genai\n", "genai.configure(api_key = api_key)" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "\n", "file = genai.upload_file(\"video.mp4\")" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "from llama_index.llms.gemini import Gemini\n", "llm = Gemini(model_name = \"models/gemini-1.5-pro\")\n", "response = llm.complete([\"tell me the content of this video\",file])" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'This video is a tutorial on linear regression. The narrator explains that linear regression is a statistical technique for modeling the relationship between an output variable and one or more input variables. The narrator explains that this is done by fitting a line through data points. The narrator explains the linear function y = mx + b, where y is the output variable, x is the input variable, m is the slope of the line, and b is the intercept of the line. The narrator explains that the coefficients m and b are what are solved for in linear regression. The narrator explains that the differences between the points and the line are called residuals. The narrator explains that the sum of the squared errors is the loss function. The narrator explains that the coefficients can be solved with a variety of techniques, including matrix decomposition and gradient descent. The narrator explains that to validate a linear regression, a third of the data is put into a test data set, and the remaining two-thirds become the training data set. The training data set is used to fit the regression line, and the test data set is used to validate the regression line. The narrator explains that metrics used to evaluate the linear regression vary from the r-squared, standard error of the estimate, prediction intervals, and statistical significance. The narrator recommends two books, “Essential Math for Data Science” and “Getting Started with SQL.” The narrator also teaches classes on the O’Reilly platform, including machine learning from scratch, probability, and SQL.'" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "response.text" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.0" } }, "nbformat": 4, "nbformat_minor": 2 }