eaglelandsonce commited on
Commit
1c97873
1 Parent(s): 2a7bc10

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +35 -11
app.py CHANGED
@@ -1,13 +1,37 @@
 
1
  import requests
2
 
3
- # Variables
4
- BASE_URL = "https://api.twelvelabs.io/v1.2"
5
- api_key = "tlk_3CPMVGM0ZPTKNT2TKQ3Y62TA7ZY9"
6
- data = {
7
- "video_id": "6636cf7fd1cd5a287c957cf5",
8
- "type": "summary",
9
- "prompt": "list the top 4 job interview mistakes and how to improve"
10
- }
11
-
12
- # Send request
13
- response = requests.post(f"{BASE_URL}/summarize", json=data, headers={"x-api-key": api_key})
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
  import requests
3
 
4
+ # Streamlit interface setup
5
+ st.title('Video Summary Interface')
6
+
7
+ # Input for modifying the prompt
8
+ prompt = st.text_input("Enter your prompt:",
9
+ "list the top 4 job interview mistakes and how to improve")
10
+
11
+ # Slider to adjust the number in the prompt
12
+ number = st.slider("Select the number of top mistakes:", min_value=1, max_value=10, value=4)
13
+
14
+ # Update the prompt with the chosen number
15
+ updated_prompt = prompt.replace("4", str(number))
16
+
17
+ # Button to send the request
18
+ if st.button("Summarize Video"):
19
+ BASE_URL = "https://api.twelvelabs.io/v1.2"
20
+ api_key = "tlk_3CPMVGM0ZPTKNT2TKQ3Y62TA7ZY9"
21
+ data = {
22
+ "video_id": "6636cf7fd1cd5a287c957cf5",
23
+ "type": "summary",
24
+ "prompt": updated_prompt
25
+ }
26
+
27
+ # Send the request
28
+ response = requests.post(f"{BASE_URL}/summarize", json=data, headers={"x-api-key": api_key})
29
+
30
+ # Check if the response is successful
31
+ if response.status_code == 200:
32
+ st.text_area("Summary:", response.json()['summary'], height=300)
33
+ else:
34
+ st.error("Failed to fetch summary: " + response.text)
35
+
36
+ # Run this script using the following command:
37
+ # streamlit run your_script_name.py