Update app.py
Browse files
app.py
CHANGED
@@ -6,6 +6,7 @@ import streamlit as st
|
|
6 |
|
7 |
|
8 |
HF_API_KEY=st.secrets["HF_API_KEY"]
|
|
|
9 |
|
10 |
# img2text
|
11 |
def img2text(url):
|
@@ -26,7 +27,7 @@ def generate_description(caption):
|
|
26 |
|
27 |
prompt = PromptTemplate(template=template, input_variables=["caption"])
|
28 |
|
29 |
-
desc_llm = LLMChain(llm=OpenAI(model_name="gpt-4-1106-preview", temperature=1), prompt=prompt, verbose=True)
|
30 |
description = desc_llm.predict(caption=caption).replace('"', '')
|
31 |
|
32 |
print(description)
|
|
|
6 |
|
7 |
|
8 |
HF_API_KEY=st.secrets["HF_API_KEY"]
|
9 |
+
OpenAI_API_Key=st.secrets["OPENAI_API_KEY"]
|
10 |
|
11 |
# img2text
|
12 |
def img2text(url):
|
|
|
27 |
|
28 |
prompt = PromptTemplate(template=template, input_variables=["caption"])
|
29 |
|
30 |
+
desc_llm = LLMChain(llm=OpenAI(model_name="gpt-4-1106-preview", temperature=1,api_key=OpenAI_API_Key), prompt=prompt, verbose=True)
|
31 |
description = desc_llm.predict(caption=caption).replace('"', '')
|
32 |
|
33 |
print(description)
|