Update app.py
Browse files
app.py
CHANGED
@@ -730,9 +730,10 @@ def deploy_to_huggingface(code: str):
|
|
730 |
|
731 |
api = HfApi(token=token)
|
732 |
space_name = generate_space_name()
|
|
|
733 |
|
734 |
# Space 생성
|
735 |
-
repo_id = f"{
|
736 |
create_repo(
|
737 |
repo_id,
|
738 |
repo_type="space",
|
@@ -751,12 +752,13 @@ def deploy_to_huggingface(code: str):
|
|
751 |
repo_type="space"
|
752 |
)
|
753 |
|
754 |
-
#
|
755 |
-
space_url = f"https://
|
756 |
-
return f"배포 완료!
|
757 |
|
758 |
except Exception as e:
|
759 |
return f"배포 중 오류 발생: {str(e)}"
|
|
|
760 |
|
761 |
# Demo 인스턴스 생성
|
762 |
demo_instance = Demo()
|
@@ -824,8 +826,8 @@ with gr.Blocks(css_paths="app.css",theme=theme) as demo:
|
|
824 |
clear_btn = antd.Button("Clear", type="default", size="large")
|
825 |
|
826 |
# 배포 결과를 표시할 텍스트 영역 추가
|
827 |
-
deploy_result = gr.Textbox(label="배포 결과", interactive=False)
|
828 |
|
|
|
829 |
|
830 |
with antd.Col(span=24, md=16):
|
831 |
with ms.Div(elem_classes="right_panel"):
|
|
|
730 |
|
731 |
api = HfApi(token=token)
|
732 |
space_name = generate_space_name()
|
733 |
+
username = api.whoami()['name']
|
734 |
|
735 |
# Space 생성
|
736 |
+
repo_id = f"{username}/{space_name}"
|
737 |
create_repo(
|
738 |
repo_id,
|
739 |
repo_type="space",
|
|
|
752 |
repo_type="space"
|
753 |
)
|
754 |
|
755 |
+
# 새로운 URL 형식으로 반환
|
756 |
+
space_url = f"https://{username}-{space_name}.hf.space"
|
757 |
+
return f"""배포 완료! <a href="{space_url}" target="_blank" style="color: #1890ff; text-decoration: underline; cursor: pointer;">여기를 클릭하여 열기</a>"""
|
758 |
|
759 |
except Exception as e:
|
760 |
return f"배포 중 오류 발생: {str(e)}"
|
761 |
+
|
762 |
|
763 |
# Demo 인스턴스 생성
|
764 |
demo_instance = Demo()
|
|
|
826 |
clear_btn = antd.Button("Clear", type="default", size="large")
|
827 |
|
828 |
# 배포 결과를 표시할 텍스트 영역 추가
|
|
|
829 |
|
830 |
+
deploy_result = gr.HTML(label="배포 결과")
|
831 |
|
832 |
with antd.Col(span=24, md=16):
|
833 |
with ms.Div(elem_classes="right_panel"):
|