Samarth991 commited on
Commit
e9c1b37
·
1 Parent(s): de997fa

Addind Chat functions to QA retrival chain

Browse files
Files changed (1) hide show
  1. app.py +27 -30
app.py CHANGED
@@ -54,8 +54,6 @@ 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
- 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
@@ -133,6 +131,33 @@ with gr.Blocks(css=css) as demo:
133
  gr.Markdown(
134
  """**Chat over you tube videos with [Falcon-7B-Instruct or ChatGPT]!**
135
  """)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136
  with gr.Group():
137
  chatbot = gr.Chatbot(height=300)
138
 
@@ -141,34 +166,6 @@ with gr.Blocks(css=css) as demo:
141
  submit_btn = gr.Button(value="Send message", variant="primary", scale = 1)
142
  clean_chat_btn = gr.Button("Delete Chat")
143
 
144
- with gr.Column():
145
- with gr.Box():
146
- with gr.Row():
147
- LLM_option = gr.Dropdown(['HuggingFace','OpenAI'],label='Large Language Model Selection',info='LLM Service')
148
- API_key = gr.Textbox(label="Add API key", type="password",autofocus=True)
149
- with gr.Accordion(label='Advanced options', open=False):
150
- max_new_tokens = gr.Slider(
151
- label='Max new tokens',
152
- minimum=2048,
153
- maximum=MAX_NEW_TOKENS,
154
- step=1,
155
- value=DEFAULT_MAX_NEW_TOKENS,
156
- )
157
- temperature = gr.Slider(
158
- label='Temperature',
159
- minimum=0.1,
160
- maximum=4.0,
161
- step=0.1,
162
- value=DEFAULT_TEMPERATURE,
163
- )
164
- char_length = gr.Slider(
165
- label='Max Character',
166
- minimum= DEFAULT_CHAR_LENGTH,
167
- maximum = 5*DEFAULT_CHAR_LENGTH,
168
- step = 500,
169
- value= 1500
170
- )
171
-
172
  with gr.Column():
173
  youtube_link = gr.Textbox(label="Add your you tube Link",text_align='left',autofocus=True)
174
  with gr.Box():
 
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
 
131
  gr.Markdown(
132
  """**Chat over you tube videos with [Falcon-7B-Instruct or ChatGPT]!**
133
  """)
134
+
135
+ with gr.Column():
136
+ with gr.Row():
137
+ LLM_option = gr.Dropdown(['HuggingFace','OpenAI'],label='Large Language Model Selection',info='LLM Service')
138
+ API_key = gr.Textbox(label="Add API key", type="password",autofocus=True)
139
+ with gr.Accordion(label='Advanced options', open=False):
140
+ max_new_tokens = gr.Slider(
141
+ label='Max new tokens',
142
+ minimum=2048,
143
+ maximum=MAX_NEW_TOKENS,
144
+ step=1,
145
+ value=DEFAULT_MAX_NEW_TOKENS,
146
+ )
147
+ temperature = gr.Slider(
148
+ label='Temperature',
149
+ minimum=0.1,
150
+ maximum=4.0,
151
+ step=0.1,
152
+ value=DEFAULT_TEMPERATURE,
153
+ )
154
+ char_length = gr.Slider(
155
+ label='Max Character',
156
+ minimum= DEFAULT_CHAR_LENGTH,
157
+ maximum = 5*DEFAULT_CHAR_LENGTH,
158
+ step = 500,
159
+ value= 1500
160
+ )
161
  with gr.Group():
162
  chatbot = gr.Chatbot(height=300)
163
 
 
166
  submit_btn = gr.Button(value="Send message", variant="primary", scale = 1)
167
  clean_chat_btn = gr.Button("Delete Chat")
168
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
169
  with gr.Column():
170
  youtube_link = gr.Textbox(label="Add your you tube Link",text_align='left',autofocus=True)
171
  with gr.Box():