Update app.py
Browse files
app.py
CHANGED
@@ -34,7 +34,6 @@ def user(text_prompt: str, chatbot: List[Tuple[str, str]]):
|
|
34 |
|
35 |
# Function to handle bot response
|
36 |
def bot(
|
37 |
-
google_key: str,
|
38 |
model_name: str,
|
39 |
video_prompt,
|
40 |
temperature: float,
|
@@ -45,8 +44,8 @@ def bot(
|
|
45 |
text_prompt_component: str,
|
46 |
chatbot: List[Tuple[str, str]]
|
47 |
):
|
48 |
-
# Use the
|
49 |
-
google_key =
|
50 |
if not google_key:
|
51 |
raise ValueError(
|
52 |
"GOOGLE_API_KEY is not set. "
|
@@ -104,15 +103,6 @@ def bot(
|
|
104 |
yield chatbot
|
105 |
|
106 |
# Define Gradio components
|
107 |
-
google_key_component = gr.Textbox(
|
108 |
-
label="GOOGLE API KEY",
|
109 |
-
value="",
|
110 |
-
type="password",
|
111 |
-
placeholder="...",
|
112 |
-
info="You have to provide your own GOOGLE_API_KEY for this app to function properly",
|
113 |
-
visible=GOOGLE_API_KEY is None
|
114 |
-
)
|
115 |
-
|
116 |
video_prompt_component = gr.Video(label="Video", autoplay=True)
|
117 |
|
118 |
model_selection = gr.Dropdown(["gemini-1.5-flash-latest", "gemini-1.5-pro-latest"], label="Select Gemini Model", value="gemini-1.5-pro-latest")
|
@@ -189,7 +179,6 @@ top_p_component = gr.Slider(
|
|
189 |
user_inputs = [text_prompt_component, chatbot_component]
|
190 |
|
191 |
bot_inputs = [
|
192 |
-
google_key_component,
|
193 |
model_selection,
|
194 |
video_prompt_component,
|
195 |
temperature_component,
|
@@ -206,7 +195,6 @@ with gr.Blocks() as demo:
|
|
206 |
gr.HTML(TITLE)
|
207 |
gr.HTML(SUBTITLE)
|
208 |
with gr.Column():
|
209 |
-
google_key_component.render()
|
210 |
with gr.Row():
|
211 |
video_prompt_component.render()
|
212 |
chatbot_component.render()
|
|
|
34 |
|
35 |
# Function to handle bot response
|
36 |
def bot(
|
|
|
37 |
model_name: str,
|
38 |
video_prompt,
|
39 |
temperature: float,
|
|
|
44 |
text_prompt_component: str,
|
45 |
chatbot: List[Tuple[str, str]]
|
46 |
):
|
47 |
+
# Use the Google API key from environment variables
|
48 |
+
google_key = GOOGLE_API_KEY
|
49 |
if not google_key:
|
50 |
raise ValueError(
|
51 |
"GOOGLE_API_KEY is not set. "
|
|
|
103 |
yield chatbot
|
104 |
|
105 |
# Define Gradio components
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
video_prompt_component = gr.Video(label="Video", autoplay=True)
|
107 |
|
108 |
model_selection = gr.Dropdown(["gemini-1.5-flash-latest", "gemini-1.5-pro-latest"], label="Select Gemini Model", value="gemini-1.5-pro-latest")
|
|
|
179 |
user_inputs = [text_prompt_component, chatbot_component]
|
180 |
|
181 |
bot_inputs = [
|
|
|
182 |
model_selection,
|
183 |
video_prompt_component,
|
184 |
temperature_component,
|
|
|
195 |
gr.HTML(TITLE)
|
196 |
gr.HTML(SUBTITLE)
|
197 |
with gr.Column():
|
|
|
198 |
with gr.Row():
|
199 |
video_prompt_component.render()
|
200 |
chatbot_component.render()
|