eaglelandsonce commited on
Commit
59e0522
1 Parent(s): 5a83ef7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +37 -31
app.py CHANGED
@@ -85,38 +85,44 @@ with tab4:
85
  st.header("Video Prompt")
86
  st.write("Information and controls related to the Scrum TruEra Assistants API.")
87
 
88
- # Embedding YouTube video directly in the Streamlit interface
89
- youtube_url = "https://www.youtube.com/watch?v=Uo0KjdDJr1c"
90
- st.video(youtube_url)
91
-
92
- # Input for modifying the prompt
93
- prompt = st.text_input("Enter your prompt:",
94
- "list the top 4 job interview mistakes and how to improve")
95
-
96
- # Slider to adjust the number in the prompt
97
- number = st.slider("Select the number of top mistakes:", min_value=1, max_value=10, value=4)
98
-
99
- # Update the prompt with the chosen number. Change the number "4" dynamically based on the slider input.
100
- updated_prompt = prompt.replace("4", str(number))
101
-
102
- # Button to send the request
103
- if st.button("Summarize Video"):
104
- BASE_URL = "https://api.twelvelabs.io/v1.2"
105
- api_key = "tlk_3CPMVGM0ZPTKNT2TKQ3Y62TA7ZY9"
106
- data = {
107
- "video_id": "6636cf7fd1cd5a287c957cf5",
108
- "type": "summary",
109
- "prompt": updated_prompt
110
- }
111
-
112
- # Send the request
113
- response = requests.post(f"{BASE_URL}/summarize", json=data, headers={"x-api-key": api_key})
114
 
115
- # Check if the response is successful
116
- if response.status_code == 200:
117
- st.text_area("Summary:", response.json()['summary'], height=300)
118
- else:
119
- st.error("Failed to fetch summary: " + response.text)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
 
121
  # Run this script using the following command:
122
  # streamlit run your_script_name.py
 
85
  st.header("Video Prompt")
86
  st.write("Information and controls related to the Scrum TruEra Assistants API.")
87
 
88
+ # Creating two columns for layout
89
+ col1, col2 = st.columns(2)
90
+
91
+ # Embedding YouTube video directly in the left column
92
+ with col1:
93
+ youtube_url = "https://www.youtube.com/watch?v=Uo0KjdDJr1c"
94
+ st.video(youtube_url)
95
+
96
+ # Using the right column for prompt modification and response
97
+ with col2:
98
+ # Input for modifying the prompt
99
+ prompt = st.text_input("Enter your prompt:",
100
+ "list the top 4 job interview mistakes and how to improve")
 
 
 
 
 
 
 
 
 
 
 
 
 
101
 
102
+ # Slider to adjust the number in the prompt
103
+ number = st.slider("Select the number of top mistakes:", min_value=1, max_value=10, value=4)
104
+
105
+ # Update the prompt with the chosen number
106
+ updated_prompt = prompt.replace("4", str(number))
107
+
108
+ # Button to send the request
109
+ if st.button("Summarize Video"):
110
+ BASE_URL = "https://api.twelvelabs.io/v1.2"
111
+ api_key = "tlk_3CPMVGM0ZPTKNT2TKQ3Y62TA7ZY9"
112
+ data = {
113
+ "video_id": "6636cf7fd1cd5a287c957cf5",
114
+ "type": "summary",
115
+ "prompt": updated_prompt
116
+ }
117
+
118
+ # Send the request
119
+ response = requests.post(f"{BASE_URL}/summarize", json=data, headers={"x-api-key": api_key})
120
+
121
+ # Check if the response is successful
122
+ if response.status_code == 200:
123
+ st.text_area("Summary:", response.json()['summary'], height=300)
124
+ else:
125
+ st.error("Failed to fetch summary: " + response.text)
126
 
127
  # Run this script using the following command:
128
  # streamlit run your_script_name.py