ysharma HF staff commited on
Commit
3328298
1 Parent(s): f968014

update button and html styles

Browse files
Files changed (1) hide show
  1. app.py +16 -9
app.py CHANGED
@@ -120,7 +120,10 @@ def upload_files_to_space(repo_link, hf_token):
120
 
121
  repo_url = f"https://huggingface.co/spaces/{user_name}/LangChain_{repo_name}Bot"
122
  space_name = f"{user_name}/LangChain_{repo_name}Bot"
123
- return f"Successfully created the Chatbot at: <a href="+ repo_url + " target='_blank'>" + space_name + "</a>"
 
 
 
124
 
125
  def driver(repo_link, hf_token):
126
  #create search index openai_api_key=openai_api_key
@@ -133,20 +136,24 @@ def driver(repo_link, hf_token):
133
  print(f"html tag is : {html_tag}")
134
  return html_tag
135
 
136
-
 
137
 
138
  #Gradio code for Repo as input and search index as output file
139
  with gr.Blocks() as demo:
140
- with gr.Row():
141
- repo_link = gr.Textbox(label="Enter Github repo name")
142
- hf_token_in = gr.Textbox(type='password', label="Enter hf-token name")
143
- openai_api_key = gr.Textbox(type='password', label="Enter your OpenAI API key here")
144
- with gr.Row():
145
  btn_faiss = gr.Button("Create Search index")
146
- btn_create_space = gr.Button("Create YOur Chatbot")
 
 
 
147
  html_out = gr.HTML()
148
- search_index_file = gr.File()
149
  btn_faiss.click(create_search_index, [repo_link, openai_api_key],search_index_file )
 
150
  btn_create_space.click(driver, [repo_link, hf_token_in], html_out)
151
 
152
  demo.queue()
120
 
121
  repo_url = f"https://huggingface.co/spaces/{user_name}/LangChain_{repo_name}Bot"
122
  space_name = f"{user_name}/LangChain_{repo_name}Bot"
123
+ #return f"Successfully created the Chatbot at: <a href="+ repo_url + " target='_blank'>" + space_name + "</a>"
124
+ return "<p style='color: orange; text-align: center; font-size: 24px; background-color: lightgray; display: inline-block;'>Successfully created the Chatbot at: <a href="+ repo_url + " target='_blank'>" + space_name + "</a></p>"
125
+ #<p style="color: orange; text-align: center; font-size: 24px; background-color: lightgray; display: inline-block;">This is some text</p>
126
+
127
 
128
  def driver(repo_link, hf_token):
129
  #create search index openai_api_key=openai_api_key
136
  print(f"html tag is : {html_tag}")
137
  return html_tag
138
 
139
+ def set_state():
140
+ return gr.update(visible=True), gr.update(visible=True)
141
 
142
  #Gradio code for Repo as input and search index as output file
143
  with gr.Blocks() as demo:
144
+ with gr.Row() :
145
+ with gr.Column():
146
+ repo_link = gr.Textbox(label="Enter Github repo name")
147
+ openai_api_key = gr.Textbox(type='password', label="Enter your OpenAI API key here")
 
148
  btn_faiss = gr.Button("Create Search index")
149
+ search_index_file = gr.File(label= 'Search index vector')
150
+ with gr.Row():
151
+ hf_token_in = gr.Textbox(type='password', label="Enter hf-token name", visible=False)
152
+ btn_create_space = gr.Button("Create Your Chatbot", visible=False)
153
  html_out = gr.HTML()
154
+
155
  btn_faiss.click(create_search_index, [repo_link, openai_api_key],search_index_file )
156
+ search_index_file.change(fn=set_state, outputs=[hf_token_in, btn_create_space])
157
  btn_create_space.click(driver, [repo_link, hf_token_in], html_out)
158
 
159
  demo.queue()