Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -5,25 +5,15 @@ import json
|
|
5 |
URL = "198.175.88.52"
|
6 |
myport = "8080"
|
7 |
gaudi_device_url = f"http://{URL}:{myport}/generate"
|
8 |
-
|
9 |
-
myip_spr = os.environ["myip_spr"]
|
10 |
-
myip_clx = os.environ["myip_clx"]
|
11 |
-
myport = os.environ["myport"]
|
12 |
-
|
13 |
-
SPR = f"http://{myip_spr}:{myport}"
|
14 |
-
CLX = f"http://{myip_clx}:{myport}"
|
15 |
-
|
16 |
-
def greet(name):
|
17 |
-
return "Hello " + name + "!!"
|
18 |
|
19 |
def text_gen(url, prompt):
|
20 |
-
resp = requests.post(url,
|
21 |
-
return resp
|
22 |
|
23 |
demo = gr.Interface(
|
24 |
fn=text_gen,
|
25 |
-
inputs=[gaudi_device_url],
|
26 |
-
outputs=["text"]
|
27 |
|
28 |
-
#demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|
29 |
demo.launch(share=True)
|
|
|
|
5 |
URL = "198.175.88.52"
|
6 |
myport = "8080"
|
7 |
gaudi_device_url = f"http://{URL}:{myport}/generate"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
def text_gen(url, prompt):
|
10 |
+
resp = requests.post(url, data=json.dumps(prompt))
|
11 |
+
return resp.text
|
12 |
|
13 |
demo = gr.Interface(
|
14 |
fn=text_gen,
|
15 |
+
inputs=[gaudi_device_url, "text"],
|
16 |
+
outputs=["text"])
|
17 |
|
|
|
18 |
demo.launch(share=True)
|
19 |
+
|