ysharma HF staff commited on
Commit
5cb8f3c
1 Parent(s): 25be809

update repo_id tag

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -81,6 +81,8 @@ def upload_files_to_space(repo_link, hf_token):
81
  print("***********INSIDE UPLOAD FILES TO SPACE***************")
82
  repo_name = repo_link.split('/')[-1]
83
  api = HfApi(token=hf_token)
 
 
84
  #Replacing the repo namein app.py
85
  with open("template/app_og.py", "r") as f:
86
  app = f.read()
@@ -95,28 +97,27 @@ def upload_files_to_space(repo_link, hf_token):
95
  api.upload_file(
96
  path_or_fileobj = "template/app.py",
97
  path_in_repo = "app.py",
98
- repo_id = f'LangChain_{repo_name}Bot', #model_id,
99
  token = hf_token,
100
  repo_type="space",)
101
  #Uploading the new search_index file to the new space
102
  api.upload_file(
103
  path_or_fileobj = "search_index.pickle",
104
  path_in_repo = "search_index.pickle",
105
- repo_id = f'LangChain_{repo_name}Bot', #model_id,
106
  token = hf_token,
107
  repo_type="space",)
108
  #Upload requirements.txt to the space
109
  api.upload_file(
110
  path_or_fileobj="template/requirements.txt",
111
  path_in_repo="requirements.txt",
112
- repo_id=model_id,
113
  token=token,
114
  repo_type="space",)
115
  #Deleting the files - search_index and app.py file
116
  os.remove("template/app.py")
117
  os.remove("search_index.pickle")
118
 
119
- user_name = whoami(token=hf_token)['name']
120
  repo_url = f"https://huggingface.co/spaces/{user_name}/LangChain_{repo_name}Bot"
121
  space_name = f"{user_name}/LangChain_{repo_name}Bot"
122
  return f"Successfully created the Chatbot at: <a href="+ repo_url + " target='_blank'>" + space_name + "</a>"
 
81
  print("***********INSIDE UPLOAD FILES TO SPACE***************")
82
  repo_name = repo_link.split('/')[-1]
83
  api = HfApi(token=hf_token)
84
+ user_name = whoami(token=hf_token)['name']
85
+
86
  #Replacing the repo namein app.py
87
  with open("template/app_og.py", "r") as f:
88
  app = f.read()
 
97
  api.upload_file(
98
  path_or_fileobj = "template/app.py",
99
  path_in_repo = "app.py",
100
+ repo_id = f'{user_name}/LangChain_{repo_name}Bot', #model_id,
101
  token = hf_token,
102
  repo_type="space",)
103
  #Uploading the new search_index file to the new space
104
  api.upload_file(
105
  path_or_fileobj = "search_index.pickle",
106
  path_in_repo = "search_index.pickle",
107
+ repo_id = f'{user_name}/LangChain_{repo_name}Bot', #model_id,
108
  token = hf_token,
109
  repo_type="space",)
110
  #Upload requirements.txt to the space
111
  api.upload_file(
112
  path_or_fileobj="template/requirements.txt",
113
  path_in_repo="requirements.txt",
114
+ repo_id=f'{user_name}/LangChain_{repo_name}Bot', #model_id,
115
  token=token,
116
  repo_type="space",)
117
  #Deleting the files - search_index and app.py file
118
  os.remove("template/app.py")
119
  os.remove("search_index.pickle")
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>"