rrg92 commited on
Commit
66e6717
·
1 Parent(s): 50f1720
Files changed (1) hide show
  1. app.py +20 -1
app.py CHANGED
@@ -65,6 +65,7 @@ SpaceHost = os.environ.get("SPACE_HOST");
65
  if not SpaceHost:
66
  SpaceHost = "localhost"
67
 
 
68
  with gr.Blocks() as demo:
69
  gr.Markdown(f"""
70
  This space allow you connect SQL Server 2025 with Hugging Face to generate embeddings!
@@ -87,8 +88,26 @@ with gr.Blocks() as demo:
87
 
88
  """)
89
 
90
- SpaceName = gr.Textbox(label="Space")
91
  EndpointName = gr.Textbox(value="/embed", label = "EndpointName");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
 
93
 
94
 
 
65
  if not SpaceHost:
66
  SpaceHost = "localhost"
67
 
68
+
69
  with gr.Blocks() as demo:
70
  gr.Markdown(f"""
71
  This space allow you connect SQL Server 2025 with Hugging Face to generate embeddings!
 
88
 
89
  """)
90
 
91
+ SpaceName = gr.Textbox(label="Space", submit_btn=True)
92
  EndpointName = gr.Textbox(value="/embed", label = "EndpointName");
93
+ tsqlCommand = gr.Textbox(lines=5);
94
+
95
+
96
+ def UpdateTsql(space):
97
+ return f"""
98
+ CREATE EXTERNAL MODEL HuggingFace
99
+ WITH (
100
+ LOCATION = 'https://{SpaceHost}/v1/embeddings',
101
+ API_FORMAT = 'OpenAI',
102
+ MODEL_TYPE = EMBEDDINGS,
103
+ MODEL = '{space}'
104
+ )
105
+ """
106
+
107
+
108
+ SpaceName.submit(UpdateTsql, [SpaceName], [tsqlCommand])
109
+
110
+
111
 
112
 
113