bstraehle commited on
Commit
09c68d4
·
1 Parent(s): 296a54b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -25,10 +25,9 @@ QA_CHAIN_PROMPT = PromptTemplate(input_variables = ["context", "question"], temp
25
  YOUTUBE_DIR = "docs/youtube/"
26
  CHROMA_DIR = "docs/chroma/"
27
 
28
- shutil.rmtree(CHROMA_DIR)
29
-
30
- def invoke(openai_api_key, youtube_url, prompt):
31
  openai.api_key = openai_api_key
 
32
  if (os.path.isdir(CHROMA_DIR) == False):
33
  print(111)
34
  loader = GenericLoader(YoutubeAudioLoader([youtube_url], YOUTUBE_DIR), OpenAIWhisperParser())
@@ -53,7 +52,7 @@ description = """The app demonstrates how to use a <strong>Large Language Model<
53
 
54
  gr.close_all()
55
  demo = gr.Interface(fn=invoke,
56
- inputs = [gr.Textbox(label = "OpenAI API Key", value = "sk-", lines = 1), gr.Textbox(label = "YouTube URL", value = "https://www.youtube.com/watch?v=--khbXchTeE", lines = 1), gr.Textbox(label = "Prompt", value = "GPT-4 human level performance", lines = 1)],
57
  outputs = [gr.Textbox(label = "Completion", lines = 1)],
58
  title = "Generative AI - LLM & RAG",
59
  description = description)
 
25
  YOUTUBE_DIR = "docs/youtube/"
26
  CHROMA_DIR = "docs/chroma/"
27
 
28
+ def invoke(openai_api_key, youtube_url, prompt, process_video):
 
 
29
  openai.api_key = openai_api_key
30
+ print(process_video)
31
  if (os.path.isdir(CHROMA_DIR) == False):
32
  print(111)
33
  loader = GenericLoader(YoutubeAudioLoader([youtube_url], YOUTUBE_DIR), OpenAIWhisperParser())
 
52
 
53
  gr.close_all()
54
  demo = gr.Interface(fn=invoke,
55
+ inputs = [gr.Textbox(label = "OpenAI API Key", value = "sk-", lines = 1), gr.Textbox(label = "YouTube URL", value = "https://www.youtube.com/watch?v=--khbXchTeE", lines = 1), gr.Textbox(label = "Prompt", value = "GPT-4 human level performance", lines = 1), gr.Radio(["Yes", "No"], label="Process Video")],
56
  outputs = [gr.Textbox(label = "Completion", lines = 1)],
57
  title = "Generative AI - LLM & RAG",
58
  description = description)