Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -41,7 +41,7 @@ def youtube_link_dataloader(video_link,max_video_length=1000):
|
|
| 41 |
|
| 42 |
def youtube_chat(temperature=0.1,max_tokens=1096,API_key=None,llm_service='mistralai/Mistral-7B-v0.1',youtube_link=None,char_length=2000):
|
| 43 |
|
| 44 |
-
|
| 45 |
print("docuemt:",document)
|
| 46 |
|
| 47 |
if llm_service== 'mistralai/Mistral-7B-v0.1':
|
|
@@ -53,11 +53,13 @@ def youtube_chat(temperature=0.1,max_tokens=1096,API_key=None,llm_service='mistr
|
|
| 53 |
)
|
| 54 |
elif llm_service == 'OpenAI':
|
| 55 |
llm = chatops.get_openai_chat_model(API_key=API_key)
|
| 56 |
-
elif llm_service == '
|
| 57 |
os.environ["GROQ_API_KEY"] = API_key
|
| 58 |
llm = ChatGroq(model="llama3-8b-8192")
|
| 59 |
|
| 60 |
-
|
|
|
|
|
|
|
| 61 |
|
| 62 |
iface = gr.Interface(
|
| 63 |
fn = youtube_chat,
|
|
|
|
| 41 |
|
| 42 |
def youtube_chat(temperature=0.1,max_tokens=1096,API_key=None,llm_service='mistralai/Mistral-7B-v0.1',youtube_link=None,char_length=2000):
|
| 43 |
|
| 44 |
+
video_document = youtube_link_dataloader(link=youtube_link,char_length=char_length)
|
| 45 |
print("docuemt:",document)
|
| 46 |
|
| 47 |
if llm_service== 'mistralai/Mistral-7B-v0.1':
|
|
|
|
| 53 |
)
|
| 54 |
elif llm_service == 'OpenAI':
|
| 55 |
llm = chatops.get_openai_chat_model(API_key=API_key)
|
| 56 |
+
elif llm_service == 'llama3-8b-8192':
|
| 57 |
os.environ["GROQ_API_KEY"] = API_key
|
| 58 |
llm = ChatGroq(model="llama3-8b-8192")
|
| 59 |
|
| 60 |
+
summarize_chain = load_summarize_chain(llm=llm, chain_type='stuff', verbose = True )
|
| 61 |
+
results = summarize_chain.invoke({'input_documents':video_document})
|
| 62 |
+
return results['output_text']
|
| 63 |
|
| 64 |
iface = gr.Interface(
|
| 65 |
fn = youtube_chat,
|