|
import streamlit as st |
|
import requests |
|
|
|
|
|
st.title('Video Summary Interface') |
|
|
|
|
|
prompt = st.text_input("Enter your prompt:", |
|
"list the top 4 job interview mistakes and how to improve") |
|
|
|
|
|
number = st.slider("Select the number of top mistakes:", min_value=1, max_value=10, value=4) |
|
|
|
|
|
updated_prompt = prompt.replace("4", str(number)) |
|
|
|
|
|
if st.button("Summarize Video"): |
|
BASE_URL = "https://api.twelvelabs.io/v1.2" |
|
api_key = "tlk_3CPMVGM0ZPTKNT2TKQ3Y62TA7ZY9" |
|
data = { |
|
"video_id": "6636cf7fd1cd5a287c957cf5", |
|
"type": "summary", |
|
"prompt": updated_prompt |
|
} |
|
|
|
|
|
response = requests.post(f"{BASE_URL}/summarize", json=data, headers={"x-api-key": api_key}) |
|
|
|
|
|
if response.status_code == 200: |
|
st.text_area("Summary:", response.json()['summary'], height=300) |
|
else: |
|
st.error("Failed to fetch summary: " + response.text) |
|
|
|
|
|
|
|
|