MediaSearch / app.py
azamat's picture
Add width and height to video element
c235c30
import os
import gdown
import gradio as gr
from weaviate_explorer import WeaviateExplorer
weaviate_explorer = WeaviateExplorer()
examples = [
"How can I validate my idea with potential customers?",
"How much funding will I need to get started?",
"What are the potential revenue streams and business models?",
"How should I structure my team and distribute equity?",
"What are the must-have features for my minimum viable product (MVP)?",
"Should I outsource any development work or hire in-house talent?",
"What metrics should I track to measure success and growth?",
"What are the key elements of a compelling pitch deck and investor presentation?",
"How can I negotiate fair and favorable terms with investors?",
"How can I generate early traction and attract my first customers?",
"What marketing and advertising channels should I prioritize?",
"How can I gather and incorporate customer feedback for product improvement?",
"What are the key areas I need to focus on for scaling (product development, hiring, operations, etc.)?",
"What are the different types of funding rounds (Seed, Series A, B, C, etc.), and when should I pursue them?",
"How can I effectively communicate progress and updates to investors?",
"How can I optimize my pricing and revenue models for profitability?",
"How can I develop and strengthen my leadership skills?",
"How can I maintain a healthy work-life balance and avoid burnout?",
"How can I maintain a strong company culture and values as we scale?",
"Is my idea truly unique and solving a real problem?"
]
def search(query):
shorts = weaviate_explorer.explore(query)
download_url = f"https://drive.google.com/uc?id={shorts[0]['link'].split('/')[-2]}"
video_path = gdown.download(download_url, output=f"./video.mp4")
return shorts[0]['title'], video_path #, "\n\n".join([f"- [{r['title']}]({r['link']})" for r in shorts])
# title = "<center>Slideo based on YCombinator</center>"
# description = "Enter a search query, question or topic to receive the top 5 most relevant short video answers. The most relevant clip will be displayed separately, and it will also be included in the list of top 5 video titles with links to Google Drive."
input_text = gr.Textbox(placeholder = "Your query, question, topic, ...", label = "Query")
title = gr.Markdown()
video = gr.Video(width=640, height=360, label = "Most relevant clip")
iface = gr.Interface(fn=search,
inputs=input_text,
outputs=[title, video],
# outputs=[video, output_text],
# title=title,
# description=description,
# examples=[[e] for e in examples],
cache_examples="lazy",
theme="dark-gradients")
iface.dependencies[0]["show_progress"] = "hidden"
iface.launch(auth=(os.getenv("username"), os.getenv("password")))