bstraehle commited on
Commit
c8f85cc
·
1 Parent(s): 52f3a4a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -16,8 +16,8 @@ _ = load_dotenv(find_dotenv())
16
 
17
  #openai.api_key = os.environ["OPENAI_API_KEY"]
18
 
19
- template = """Use the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know,
20
- don't try to make up an answer. Keep the answer as concise as possible. Always say "\n\nThanks for using the app, Bernd Straehle 🔥" at the end of the answer.
21
  {context} Question: {question} Helpful Answer: """
22
 
23
  QA_CHAIN_PROMPT = PromptTemplate(input_variables = ["context", "question"], template = template)
@@ -42,11 +42,12 @@ description = """The app demonstrates how to use a <strong>Large Language Model<
42
  Enter an OpenAI API key, YouTube URL (external data), and prompt to search the video, analyse its sentiment, summarize it, and/or translate it, etc.\n\n
43
  Implementation: <a href='https://www.gradio.app/'>Gradio</a> UI using <a href='https://platform.openai.com/'>OpenAI</a> API
44
  via AI-first toolkit <a href='https://www.langchain.com/'>LangChain</a> with foundation models
45
- <a href='https://openai.com/research/whisper'>Whisper</a> (speech to text) and <a href='https://openai.com/research/gpt-4'>GPT-4</a> (LLM use cases)."""
 
46
 
47
  gr.close_all()
48
  demo = gr.Interface(fn=invoke,
49
- inputs = [gr.Textbox(label = "OpenAI API Key", value = "sk-", lines = 1), gr.Textbox(label = "YouTube URL", value = "https://www.youtube.com/watch?v=GJm7H9IP5SU", lines = 1), gr.Textbox(label = "Prompt", value = "Translate song into English", lines = 1)],
50
  outputs = [gr.Textbox(label = "Completion", lines = 1)],
51
  title = "Generative AI - LLM & RAG",
52
  description = description)
 
16
 
17
  #openai.api_key = os.environ["OPENAI_API_KEY"]
18
 
19
+ template = """Use the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up
20
+ an answer. Keep the answer as concise as possible. Always say "\n\n🔥 Thanks for using the app, Bernd Straehle." at the end of the answer.
21
  {context} Question: {question} Helpful Answer: """
22
 
23
  QA_CHAIN_PROMPT = PromptTemplate(input_variables = ["context", "question"], template = template)
 
42
  Enter an OpenAI API key, YouTube URL (external data), and prompt to search the video, analyse its sentiment, summarize it, and/or translate it, etc.\n\n
43
  Implementation: <a href='https://www.gradio.app/'>Gradio</a> UI using <a href='https://platform.openai.com/'>OpenAI</a> API
44
  via AI-first toolkit <a href='https://www.langchain.com/'>LangChain</a> with foundation models
45
+ <a href='https://openai.com/research/whisper'>Whisper</a> (speech to text) and <a href='https://openai.com/research/gpt-4'>GPT-4</a> (LLM use cases)
46
+ and <a href='https://www.trychroma.com/'>Chroma</a> vector database."""
47
 
48
  gr.close_all()
49
  demo = gr.Interface(fn=invoke,
50
+ inputs = [gr.Textbox(label = "OpenAI API Key", value = "sk-", lines = 1), gr.Textbox(label = "YouTube URL", value = "https://www.youtube.com/watch?v=GJm7H9IP5SU", lines = 1), gr.Textbox(label = "Prompt", value = "Translate into English", lines = 1)],
51
  outputs = [gr.Textbox(label = "Completion", lines = 1)],
52
  title = "Generative AI - LLM & RAG",
53
  description = description)