Spaces:
Sleeping
Sleeping
Samarth991
commited on
Commit
·
a83288e
1
Parent(s):
42032d5
adding you tube processing LLM
Browse files
app.py
CHANGED
@@ -54,6 +54,8 @@ def process_youtube_link(link, document_name="youtube-content"):
|
|
54 |
def youtube_chat(youtube_link,API_key,llm='HuggingFace',temperature=0.1,max_tokens=1096,char_length=1500):
|
55 |
|
56 |
document = process_youtube_link(link=youtube_link)
|
|
|
|
|
57 |
embedding_model = SentenceTransformerEmbeddings(model_name='thenlper/gte-base',model_kwargs={"device": DEVICE})
|
58 |
texts = process_documents(documents=document)
|
59 |
global vector_db
|
@@ -86,7 +88,6 @@ def infer(question, history):
|
|
86 |
return result["result"]
|
87 |
|
88 |
def bot(history):
|
89 |
-
|
90 |
response = infer(history[-1][0], history)
|
91 |
history[-1][1] = ""
|
92 |
|
@@ -122,8 +123,9 @@ with gr.Blocks(css=css) as demo:
|
|
122 |
|
123 |
with gr.Column():
|
124 |
with gr.Box():
|
125 |
-
|
126 |
-
|
|
|
127 |
with gr.Accordion(label='Advanced options', open=False):
|
128 |
max_new_tokens = gr.Slider(
|
129 |
label='Max new tokens',
|
@@ -148,12 +150,11 @@ with gr.Blocks(css=css) as demo:
|
|
148 |
)
|
149 |
|
150 |
with gr.Column():
|
|
|
151 |
with gr.Box():
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
load_youtube_bt = gr.Button("Process Youtube Link",).style(full_width = False)
|
156 |
-
langchain_status = gr.Textbox(label="Status", placeholder="", interactive = False)
|
157 |
|
158 |
with gr.Group():
|
159 |
chatbot = gr.Chatbot(height=300)
|
|
|
54 |
def youtube_chat(youtube_link,API_key,llm='HuggingFace',temperature=0.1,max_tokens=1096,char_length=1500):
|
55 |
|
56 |
document = process_youtube_link(link=youtube_link)
|
57 |
+
print("Document:",document)
|
58 |
+
|
59 |
embedding_model = SentenceTransformerEmbeddings(model_name='thenlper/gte-base',model_kwargs={"device": DEVICE})
|
60 |
texts = process_documents(documents=document)
|
61 |
global vector_db
|
|
|
88 |
return result["result"]
|
89 |
|
90 |
def bot(history):
|
|
|
91 |
response = infer(history[-1][0], history)
|
92 |
history[-1][1] = ""
|
93 |
|
|
|
123 |
|
124 |
with gr.Column():
|
125 |
with gr.Box():
|
126 |
+
with gr.Row():
|
127 |
+
LLM_option = gr.Dropdown(['HuggingFace','OpenAI'],label='Large Language Model Selection',info='LLM Service')
|
128 |
+
API_key = gr.Textbox(label="Add API key", type="password",autofocus=True)
|
129 |
with gr.Accordion(label='Advanced options', open=False):
|
130 |
max_new_tokens = gr.Slider(
|
131 |
label='Max new tokens',
|
|
|
150 |
)
|
151 |
|
152 |
with gr.Column():
|
153 |
+
youtube_link = gr.Textbox(label="Add your you tube Link",text_align='left',autofocus=True)
|
154 |
with gr.Box():
|
155 |
+
with gr.row():
|
156 |
+
load_youtube_bt = gr.Button("Process Youtube Link",).style(full_width = False)
|
157 |
+
langchain_status = gr.Textbox(label="Status", placeholder="", interactive = False)
|
|
|
|
|
158 |
|
159 |
with gr.Group():
|
160 |
chatbot = gr.Chatbot(height=300)
|