Spaces:
Runtime error
Runtime error
storresbusquets
commited on
Commit
Β·
a263611
1
Parent(s):
5016b8f
Update app.py
Browse files
app.py
CHANGED
@@ -206,13 +206,13 @@ class GradioInference:
|
|
206 |
# )
|
207 |
|
208 |
########################## PRUEBA CHATGPT #################################
|
209 |
-
from langchain.chat_models import
|
210 |
from langchain.chains.llm import LLMChain
|
211 |
from langchain.prompts import PromptTemplate
|
212 |
from langchain.chains.combine_documents.stuff import StuffDocumentsChain
|
213 |
from langchain.document_loaders import WebBaseLoader
|
214 |
|
215 |
-
OPENAI_API_KEY = os.environ['OPENAI_API_KEY']
|
216 |
loader = WebBaseLoader("https://lilianweng.github.io/posts/2023-06-23-agent/")
|
217 |
|
218 |
text = results["text"]
|
@@ -223,7 +223,7 @@ class GradioInference:
|
|
223 |
prompt = PromptTemplate.from_template(prompt_template)
|
224 |
|
225 |
# Define LLM chain
|
226 |
-
llm =
|
227 |
llm_chain = LLMChain(llm=llm, prompt=prompt)
|
228 |
|
229 |
# Define StuffDocumentsChain
|
@@ -354,7 +354,7 @@ with block as demo:
|
|
354 |
title = gr.Label(label="Video Title")
|
355 |
|
356 |
with gr.Row().style(equal_height=True):
|
357 |
-
img = gr.Image(label="Thumbnail"
|
358 |
text = gr.Textbox(
|
359 |
label="Transcription",
|
360 |
placeholder="Transcription Output...",
|
@@ -373,9 +373,9 @@ with block as demo:
|
|
373 |
|
374 |
with gr.Row().style(equal_height=True):
|
375 |
clear = gr.ClearButton(
|
376 |
-
[link, title, img, text, summary, keywords, label, wordcloud_image], scale=1, value="Clear ποΈ"
|
377 |
)
|
378 |
-
btn = gr.Button("Get video insights π", variant="primary", scale=1
|
379 |
btn.click(
|
380 |
gio,
|
381 |
inputs=[link, lang, size],
|
@@ -413,9 +413,9 @@ with block as demo:
|
|
413 |
wordcloud_image = gr.Image(label="WordCloud")
|
414 |
|
415 |
with gr.Row().style(equal_height=True):
|
416 |
-
clear = gr.ClearButton([audio_file,text, summary, keywords, label, wordcloud_image], scale=1, value="Clear ποΈ"
|
417 |
btn = gr.Button(
|
418 |
-
"Get audio insights π", variant="primary", scale=1
|
419 |
)
|
420 |
btn.click(
|
421 |
gio.from_audio_input,
|
|
|
206 |
# )
|
207 |
|
208 |
########################## PRUEBA CHATGPT #################################
|
209 |
+
from langchain.chat_models import ChatOllama
|
210 |
from langchain.chains.llm import LLMChain
|
211 |
from langchain.prompts import PromptTemplate
|
212 |
from langchain.chains.combine_documents.stuff import StuffDocumentsChain
|
213 |
from langchain.document_loaders import WebBaseLoader
|
214 |
|
215 |
+
# OPENAI_API_KEY = os.environ['OPENAI_API_KEY']
|
216 |
loader = WebBaseLoader("https://lilianweng.github.io/posts/2023-06-23-agent/")
|
217 |
|
218 |
text = results["text"]
|
|
|
223 |
prompt = PromptTemplate.from_template(prompt_template)
|
224 |
|
225 |
# Define LLM chain
|
226 |
+
llm = ChatOllama(model_name="llama2:7b-chat")
|
227 |
llm_chain = LLMChain(llm=llm, prompt=prompt)
|
228 |
|
229 |
# Define StuffDocumentsChain
|
|
|
354 |
title = gr.Label(label="Video Title")
|
355 |
|
356 |
with gr.Row().style(equal_height=True):
|
357 |
+
img = gr.Image(label="Thumbnail")
|
358 |
text = gr.Textbox(
|
359 |
label="Transcription",
|
360 |
placeholder="Transcription Output...",
|
|
|
373 |
|
374 |
with gr.Row().style(equal_height=True):
|
375 |
clear = gr.ClearButton(
|
376 |
+
[link, title, img, text, summary, keywords, label, wordcloud_image], scale=1, value="Clear ποΈ"
|
377 |
)
|
378 |
+
btn = gr.Button("Get video insights π", variant="primary", scale=1)
|
379 |
btn.click(
|
380 |
gio,
|
381 |
inputs=[link, lang, size],
|
|
|
413 |
wordcloud_image = gr.Image(label="WordCloud")
|
414 |
|
415 |
with gr.Row().style(equal_height=True):
|
416 |
+
clear = gr.ClearButton([audio_file,text, summary, keywords, label, wordcloud_image], scale=1, value="Clear ποΈ")
|
417 |
btn = gr.Button(
|
418 |
+
"Get audio insights π", variant="primary", scale=1
|
419 |
)
|
420 |
btn.click(
|
421 |
gio.from_audio_input,
|