eaglelandsonce commited on
Commit
0f2c023
1 Parent(s): 913c773

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -31
app.py CHANGED
@@ -4,37 +4,7 @@ import requests
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
38
 
39
  # Creating tabs,
40
  tab1, tab2, tab3, tab4, tab5 = st.tabs(["Project Description", "Video Uploader", "Video Indexer", "Video Prompt", "Unique Value Add"])
@@ -73,7 +43,40 @@ with tab3:
73
  with tab4:
74
  st.header("Video Prompt")
75
  st.write("Information and controls related to the Scrum TruEra Assistants API.")
76
- # Integration and API controls could be managed here
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
 
78
  with tab5:
79
  st.header("Unique Value Add")
 
4
  # Streamlit interface setup
5
  st.title('Video Summary Interface')
6
 
 
 
 
7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
  # Creating tabs,
10
  tab1, tab2, tab3, tab4, tab5 = st.tabs(["Project Description", "Video Uploader", "Video Indexer", "Video Prompt", "Unique Value Add"])
 
43
  with tab4:
44
  st.header("Video Prompt")
45
  st.write("Information and controls related to the Scrum TruEra Assistants API.")
46
+
47
+ # Input for modifying the prompt
48
+ prompt = st.text_input("Enter your prompt:",
49
+ "list the top 4 job interview mistakes and how to improve")
50
+
51
+ # Slider to adjust the number in the prompt
52
+ number = st.slider("Select the number of top mistakes:", min_value=1, max_value=10, value=4)
53
+
54
+ # Update the prompt with the chosen number
55
+ updated_prompt = prompt.replace("4", str(number))
56
+
57
+ # Button to send the request
58
+ if st.button("Summarize Video"):
59
+ BASE_URL = "https://api.twelvelabs.io/v1.2"
60
+ api_key = "tlk_3CPMVGM0ZPTKNT2TKQ3Y62TA7ZY9"
61
+ data = {
62
+ "video_id": "6636cf7fd1cd5a287c957cf5",
63
+ "type": "summary",
64
+ "prompt": updated_prompt
65
+ }
66
+
67
+ # Send the request
68
+ response = requests.post(f"{BASE_URL}/summarize", json=data, headers={"x-api-key": api_key})
69
+
70
+ # Check if the response is successful
71
+ if response.status_code == 200:
72
+ st.text_area("Summary:", response.json()['summary'], height=300)
73
+ else:
74
+ st.error("Failed to fetch summary: " + response.text)
75
+
76
+ # Run this script using the following command:
77
+ # streamlit run your_script_name.py
78
+
79
+
80
 
81
  with tab5:
82
  st.header("Unique Value Add")