Update app.py
Browse files
app.py
CHANGED
@@ -7,6 +7,7 @@ import streamlit as st
|
|
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,7 +28,7 @@ def generate_description(caption):
|
|
27 |
|
28 |
prompt = PromptTemplate(template=template, input_variables=["caption"])
|
29 |
|
30 |
-
desc_llm = LLMChain(llm=
|
31 |
description = desc_llm.predict(caption=caption).replace('"', '')
|
32 |
|
33 |
print(description)
|
|
|
7 |
|
8 |
HF_API_KEY=st.secrets["HF_API_KEY"]
|
9 |
OpenAI_API_Key=st.secrets["OPENAI_API_KEY"]
|
10 |
+
openai_instance = OpenAI(api_key=OpenAI_API_Key)
|
11 |
|
12 |
# img2text
|
13 |
def img2text(url):
|
|
|
28 |
|
29 |
prompt = PromptTemplate(template=template, input_variables=["caption"])
|
30 |
|
31 |
+
desc_llm = LLMChain(llm=openai_instance, prompt=prompt, verbose=True)
|
32 |
description = desc_llm.predict(caption=caption).replace('"', '')
|
33 |
|
34 |
print(description)
|